I want to use a if statement to check if a file size is greater than a determined number in kb.
For example:
if(filesize GTREATER than VARX){
DO
}else{
DO
}
I’m new to C yet, so please, can you explain clearly, if I have to use a different function.
If you’ve already
fopen()ed the file, then you can usefstat().stat()orlstat()can be used on files by name (in a string), but are somewhat less efficient if you do it repeatedly. You’ll need to usefileno()to get the file descriptor (int) from theFILE *returned byfopen(). Otherwise, the man pages have reasonable examples.