.dsy:it.
Show 150 posts per page

.dsy:it. (http://www.dsy.it/forum/)
- Algoritmi e strutture dati (http://www.dsy.it/forum/forumdisplay.php?forumid=207)
-- aiuto file??? (http://www.dsy.it/forum/showthread.php?threadid=42646)


Posted by fra85 on 31-01-2012 17:57:

aiuto file???

Salve ragazzi spero potete aiutarmi...
Non so come mai con gcc non mi riconosce il file...

int main(int argc, char *argv[])
{
char stringa1[N];
printf("Specifica il nome del file da leggere:");
fgets( stringa1, N, stdin);
leggi_file(stringa1);

}

void leggi_file(char *file)
{
FILE *pf ; //puntatore al file
pf = fopen(file , "r" ) ;//apro il file in lettura

//controllo se il file esiste

if(pf)
{
//codice interno
}
else
{
printf("FILE NON TROVATO");
}

}

il file si trova nella stessa cartella dell'eseguibile,su ubuntu,ma non lo trova. Il programma l'avevo giĆ  provato con dev c++ e funziona,qui invece mi da problemi


Posted by fra85 on 31-01-2012 18:04:

Non so come mai,ma con scanf invece che fgets non mi da problemi...


All times are GMT. The time now is 21:30.
Show all 2 posts from this thread on one page

Powered by: vBulletin Version 2.3.1
Copyright © Jelsoft Enterprises Limited 2000 - 2002.