The 1st record in the file can store the number of total records. It
does not have to be duplicated in each record. So, your information will
start from 2nd record onwards.
-Mandeep
-----Original Message-----
From: Alvaro Agustin Fernandez [mailto:[log in to unmask]]
Sent: Friday, April 07, 2000 5:49 PM
To: [log in to unmask]
Subject: Re: Count Direct Access File Records
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|