Hi all,
I want to find the size of proc file using C....can somebody help!!!!

what is a "proc file"? If you want to find the size of a file that is stored on your hard drive then there are a cople opeions: (1) call _stat() function, or (2) open the file, seek to the end, then get the current file pointer position.

what is a "proc file"? If you want to find the size of a file that is stored on your hard drive then there are a cople opeions: (1) call _stat() function, or (2) open the file, seek to the end, then get the current file pointer position.

Well, proc file system is basically a virtual file system and these files are not stored in the hard disc of computer..if it would have been a regular file that is stored in the hard disc, then i could have easily found out the size but here my requirement is that as soon as i 'fopen()' a proc file, i want to know the total size of the proc file in bytes...as i want to read the whole proc file by using 'fread()'....i know that one option could have been using fgetc() uptill EOF is reached by i want to avoid that as it can be time consuming in case of very big proc files...can there be an alternative???

Try reading 1000 bytes at a time with fread then.

Thanx nucleon... This seems to be a work around....i was hoping that somebody can hint me towards some standard way...newaz...thanx...

This article has been dead for over six months. Start a new discussion instead.