Hirdetés
Új hozzászólás Aktív témák
-
Hali!
Valamiért nem akar ez működni és nem tudom miért.Annyira nem lenne érdekes,mert másik kóddal működik,de meg szeretnék tanulni programozni amihez értenem is kell.HA már VIK akkor csatlakozok,hogy a goto-ért exit jár

#inlude <stdio.h>
#include <stdlib.h>
#include <conio.h>
main ()
{
File*fp
char c;
fp=fopen("C:\prog\blabla.txt","r");
if(fp==NULL){printf("Hiba a fajl olvasasnal");exit(1);}
while(!feof(fp)){
c=fgetc(fp);
fputc(c,stdout);
}
fclose(fp);
exit(0);
}Ez nem akar működni,VS8 fatal error C1021: invalid preprocessor command 'inlude'
Code blocks: progi\main.c|1|invalid preprocessing directive #inlude|
progi\main.c|6|warning: return type defaults to `int'|
progi\main.c||In function `main':|
progi\main.c|7|error: `File' undeclared (first use in this function)|
progi\main.c|7|error: (Each undeclared identifier is reported only once|
progi\main.c|7|error: for each function it appears in.)|
progi\main.c|8|error: `fp' undeclared (first use in this function)|
progi\main.c|8|error: syntax error before "char"|
progi\main.c|9|warning: implicit declaration of function `fopen'|
progi\main.c|9|warning: unknown escape sequence '\p'|
progi\main.c|9|warning: unknown escape sequence '\P'|
progi\main.c|10|warning: implicit declaration of function `printf'|
progi\main.c|11|warning: implicit declaration of function `feof'|
progi\main.c|12|error: `c' undeclared (first use in this function)|
progi\main.c|12|warning: implicit declaration of function `fgetc'|
progi\main.c|13|warning: implicit declaration of function `fputc'|
progi\main.c|13|error: `stdout' undeclared (first use in this function)|
progi\main.c|15|warning: implicit declaration of function `fclose'|
||=== Build finished: 8 errors, 9 warnings ===|Helyette ez müxik,de még alakítani,kell hogy beolvassam dinamikus adatszerkezetbe.
#include <stdio.h>
void main()
{
int c;
FILE *fp;
if( (fp = fopen("C:\\prog\\blabla.txt","rt")) == NULL )
{
printf("\nHiba a blabla.blabl megnyitásánál !");
// Kilépés a programból
exit(0);
}
// Elôolvasás.
c = fgetc(fp);
// Amíg nincs file vége.
while( !feof(fp) )
{
printf("\nA beolvasott karakter : %c",c);
// Olvassa a következôt.
c = fgetc(fp);
}
// A file lezárása.
fclose(fp);
}
Új hozzászólás Aktív témák
● olvasd el a téma összefoglalót!
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- OLED monitor topic
- Az év utolsó napján előbújt pár Galaxy S26 dummy
- NVIDIA GeForce RTX 5070 / 5070 Ti (GB205 / 203)
- Arc Raiders
- exHWSW - Értünk mindenhez IS
- League of Legends
- Azonnali alaplapos kérdések órája
- AMD vs. INTEL vs. NVIDIA
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- S.T.A.L.K.E.R. 2: Heart of Chornobyl
- További aktív témák...
- Ryzen 7 7700X +hűtött VRM-es B650M lap +16-32GB DDR5 RAM! GAR/SZÁMLA (a Te nevedre kiállítva)!
- 100/100% 500GB SSHD, 500GB HDD - több db - 2,5"
- Samsung Galaxy S25 Ultra 256Gb 3 hetes, újszerű
- Eladó használt Macbook Pro M1 / 16GB / 256GB SSD 2020-as
- High-End Ryzen 9 7900 Workstation / Gamer Base 64GB DDR5, 2TB Gen4 SSD, 850W
- ÁRGARANCIA!Épített KomPhone Ryzen 5 7600X 16/32/64GB RAM RX 9060XT 16GB GAMER PC termékbeszámítással
- LG UltraFine 4K és Smart Monitorok -30%
- iKing.Hu - Apple iPhone 15 Pro Max Black Titanium Titán stílus, 5 optikai zoom 256 GB- Gari
- DELL PowerEdge R730xd 16LFF 160TB+400GB 2U rack - 2xE5-2683v4 (16c/32t),256GB RAM,2x10G NET,HBA330
- Keresünk dokkolókat
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Laptopszaki Kft.
Város: Budapest



