Re: Mutli Type in same file



On Thu, 4 May 2006 15:21:48 -0400, "Tiblay" <tiblay@xxxxxxxxxxxx>
wrote:

Hello,

I try to use 2 differents TYPE in one file, the first is for keep the infos
about the rapport, and the second is the DATA. I need to save only one time
the first TYPE and after i save many time the seconde TYPE. How i can do
that ????

You need to either use a binary file and write your own get and put
code for each types..

...Or pad out the FichierRappDesc structure to be an exact multiple of
the data structures, then you can use a Random file and just offset
each record number, by the number of records the header took up.
ie: if the data type is 200 bytes, and the header is 960, then pad the
header out to 1000 bytes and read that in via binary mode. Then you
can close and reopen the file in Random mode and find record 1 at
position 6. So your code to read record #1 would be :
"get #hfile,recNo+5,data" , because the header took up the first 5
record spaces. Makes sense ?

However, using a binary file and your own read and write code is not
too hard to do, much cleaner and will make more sense later on.

--

Regards, Frank
.



Relevant Pages

  • Help With Nesting Classes In Library
    ... I am writing a class that will do some binary file IO. ... need to read a header from the binary file, and it will also need to ... private BinaryReader brMyFile; ... public static int MyCode ...
    (microsoft.public.dotnet.languages.csharp)
  • parse c c++ header to map binary block for display
    ... The program open the binary file, it casts it to the structure and it ... whenever the structure changes, i don't have to manually change my ... I thought of a parser for the C/C++ header to collect the available ...
    (comp.lang.perl.misc)
  • writing binary files
    ... I am trying to convert an ANSI encoded ASCII text file to a binary file. ... have looked at the b2a_qp(data[, quotetabs, istext, header]) function at ...
    (comp.lang.perl.misc)
  • Print a string in binary format
    ... I have a binary file and wish to see the "raw" content of it. ... it in binary mode, and read one byte at a time to a variable, which ... but I just cannot find the appropriate method from the documentation. ...
    (comp.lang.python)
  • Re: fread can not read particular data
    ... The binary value 0x1A just happens to be the ASCII value CTRL-Z. ... you have opened a binary file in text mode. ... open the binary file in binary mode. ... darrell at cs dot toronto dot edu ...
    (comp.lang.c)

Loading