Originariamente inviato da skyboy85
mmmm..se nn ti dispiace potresti scrivermi un codice di esempio???
Per determinare la lunghezza del file con fseek/ftell? Sì è semplice, puoi usare una funzioncina come questa:
codice:
long get_file_size (FILE *stream)
{
long pos, size;
if ((pos = ftell (stream)) == -1)
return -1; /* errore */
if (fseek (stream, 0, SEEK_END) != 0)
return -1; /* errore */
if ((size = ftell (stream)) == -1)
return -1; /* errore */
if (fseek (stream, pos, SEEK_SET) != 0)
return -1; /* errore */
return size;
}