Different size records in a random file? 
Author Message
 Different size records in a random file?

How can a file header with records of, say, 128 bytes be combined with
data of 2-byte integer records?

ie I want to build files comprised of a header (say a dozen records of
128 bytes each) followed by _many_ records of 2 bytes each (integers).

Currently, I am building the file as sequential output, but now I need
to have a second program modify some of the data records while leaving
the others intact, and I can't read in the entire data set in order
to re-write it with the modified data.

As far as I can tell, I can't open a file with 2 different record lengths,
so my options are:
1) write/read the header records as many individual 2-byte records (ie
   build up a single 128-byte record by reading in 64 2-byte records)
2) continue to use sequential, variable length input/output but write the
   output to a temp file.
3) ?

e-mail or post any responses.  Thanx.



Wed, 11 Dec 1996 11:12:42 GMT  
 Different size records in a random file?

Quote:

>How can a file header with records of, say, 128 bytes be combined with
>data of 2-byte integer records?
>ie I want to build files comprised of a header (say a dozen records of
>128 bytes each) followed by _many_ records of 2 bytes each (integers).
>Currently, I am building the file as sequential output, but now I need
>to have a second program modify some of the data records while leaving
>the others intact, and I can't read in the entire data set in order
>to re-write it with the modified data.
>As far as I can tell, I can't open a file with 2 different record lengths,
>so my options are:
>1) write/read the header records as many individual 2-byte records (ie
>   build up a single 128-byte record by reading in 64 2-byte records)
>2) continue to use sequential, variable length input/output but write the
>   output to a temp file.
>3) ?

You can use BINARY files.  You can read in the first 128 bytes as the header
and access the integers by using 128 + (2 * record.number).

Chad



Wed, 11 Dec 1996 23:23:41 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Random access files - having and finding multiple types of record in one file

2. Random Access File Sizes

3. Random File size-- Any limitations?

4. Userform size on different PCs/different resolutions- yikes!

5. Size Word window for different monitor sizes and resolutions

6. number of records in a random access file?

7. Form Size and different sized monitors in VB4.0

8. Locking records in a random file

9. How to remove a record from a random file

10. # Records in a RANDOM ACCESS file?

11. Locking records in a random file

12. How to delete Random file record!

 

 
Powered by phpBB® Forum Software