Ciao a tutti!
Io vorrei leggere delle stringhe da un file e per questo uso la fgets(). Tramite un ciclo while memorizzo la stringa e la stampo( per il momento ). Il problema e' che le stringhe dei file sono terminate da \n e la fgets appunto legge anche il \n, per evitare che me lo legga , io ho fatto cosi':
codice:
while( fgets( readedLine, 512, commands ) != NULL )
{
strncpy( newRead, readedLine, (strlen( readedLine ) -1) );
fprintf( stderr, "%s", newRead );
}
Puo' andar bene o e' brutto stile?