0

I am trying to find the size of a file without using stdio library.
This way (see below) works perfectly, but I can't find a way to make that work without stdio library.

int getfilesize(const char *filename){

   int size;
   FILE *f;

   f=fopen(filename, "rb");

   //pointer check
   if(f==NULL){
      return (-1);
   }

   fseek(f, 0, SEEK_END);
   size = ftell(f);
   fclose(f);

   return(size);
}
Yunnosch
  • 26,130
  • 9
  • 42
  • 54
P.George
  • 11
  • 3

0 Answers0