
FILE SIZE CHECKING FROM C PROGRAM
Quote:
>Hi everyone,
>I am having a C program which creates an output flat file using the
>fprintf function.
>Problem :
>---------
>The file size created by this program should not exceed a particular
>threshold limit.
>Question:
>----------
>How do I check from the C program to check that the file-size has not
>exceeded the threshold limit during the file creation process ?
You are in a much better position than most people who are interested
in file sizes. This problem can be solved without system specific
extentions.
Have a look at the semantics of the return value of fprintf(). The
solution should be obvious. You add up the number of bytes transferred
to the file, and you get a good rough estimate of the file size, or
even an exact value, if your system does not need any funny tricks
to store text files.
Quote:
>-------------------==== Posted via Deja News ====-----------------------
Wow, an _on_ topic article from Deja News
Kurt
--
| Kurt Watzka Phone : +49-89-2180-6254