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

Recommended Answers

All 6 Replies

Does the size of a proc file make sense?

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.

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...

Have you tried seeking the end then telling the position(fseek, ftell)?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.