get the size of a file

March 30, 2009 by admin  
Filed under C

#include
#include
#include
#include

int main()
{
int fp;

long file_size;

if ((fp = open(”f:/cprojects/urls.txt”, O_RDONLY)) == -1)
printf(”Error opening the file n”);
else
{
file_size = filelength(file_handle);
printf(”The file size in bytes is %ldn”, file_size);
close(fp);
}
return 0;
}

Related posts:

  1. exe file information #include struct EXEHEAD { char id[2]; // ‘M’ & ‘Z’...
  2. A file example #include #include const char *FILENAME = “myfile.txt”; int main() {...
  3. fat file system information #include #include void main(void) { struct fatinfo fat; getfatd(&fat); printf(”Sectors...
  4. Another file example #include #include int main() { // first lets output to...
  5. file attributes #include #include int main() { int mode; /*check a files...

Related posts brought to you by Yet Another Related Posts Plugin.

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!