Skip to content

Instantly share code, notes, and snippets.

@dlion
Created September 4, 2012 22:23
Show Gist options
  • Select an option

  • Save dlion/3627379 to your computer and use it in GitHub Desktop.

Select an option

Save dlion/3627379 to your computer and use it in GitHub Desktop.
sizeFile function, return size of a file
long sizeFile(FILE *file)
{
long pos_now,size;
//Posizione attuale
pos_now = ftell(file);
//Mi posiziono alla fine del file
fseek(file,0,SEEK_END);
//Prendo la dimensione
size = ftell(file);
//Ritorno alla posizione precedente
fseek(file,pos_now,SEEK_SET);
//Ritorno la dimensione
return size;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment