filesize()

Posted by sphinx on February 8, 2008.

/* filesize() function in C - PHP Equivalent by sphinx */
long long int filesize(char *file) {
  FILE *fp;
  long long int i = 0;
  fp = fopen(file,"rb");
  while(fgetc(fp) != EOF) {
  ++i; }
  fclose(fp);
  return i;
}

example usage:

int main(void) {
  printf("%ld", filesize("/path/to/filename"));
  return 0;
}

Bookmark this article!

BlogLinesDel.icio.usDiggFacebookFurlGoogleRedditSlashDotSphinnSpurl

SquidooStumbleUponTechnoratiYahoo

Make a Comment

Make A Comment: ( 1 so far )

blockquote and a tags work here.

One Response to “filesize()”

RSS Feed for blog @ plinplan.com Comments RSS Feed

[…] need filesize() […]

Where's The Comment Form?

Liked it here?
Why not try sites on the blogroll...

Get a Free Blog @ plinplan.net