Mandeep Singh wrote:
>
> Here is an idea, Can you store a counter in the 1st record in the file.
> Then whenever you add or delete to it you can modify the counter. Thus
> reading the counter will give you the number of records.
Would the counter be duplicated in each record? Seems wasteful,, but
if there is no other way...
Another possibility (don't know if it will work):
Can the size of records vary in a file? If not, then inquire()
about the length of the record, use a system() call to find the size
of the file, and divide.
If you don't mind my asking, why do you need to know this? Some
sort of performance statistics?
Alvaro Fernandez
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|