All pastes #639468 Raw Edit

Someone

public text v1 · immutable
#639468 ·published 2007-07-30 16:22 UTC
rendered paste body
hh guys i have question, id like to read file into multi-array -_-
So umm developing file() function in C.

So im having a problem, whats best way to determine size of file before doing a char array where i hold it?

unsigned int bufferSize = 0;
while((c = fgetc(FILEHANDLE)) != EOF)
    bufferSize++;
  
// Alright knowing that it read up chars one by one it means it readed byte by byte, so um
// bufferSize*1 should be size of my array. but now, the fgetc is end of file? or is it again on start?
// or whats better way?