Re: Portable record length



On Thu, 2006-08-10 at 12:49 +0000, Dan Nagle wrote:
Hello,

Asbjørn L. Johansen wrote:

<snip a bunch>

A good suggestion, but I need to output to a direct access, unformatted
file. The header contains 16 and 32 bit integer and 32 bit floating
point values. The data is an array of either 32 or 64 bit floating point
values.

Direct access has fixed length records, so you will waste space
in the file with this approach. If this is acceptable, then alright.

This is not an issue as I have to conform to a format specification. The
240 byte header is part of the specification and the length of the data
area is not allowed to change between records.

When reading the file, how do you signal the record length?, or is it
known from other logic?

That's the problem I'm trying to solve in a portable way. I need a
portable way of getting the record length which lets me store 240 bytes
of header + N elements of either 32 or 64 bit floating point values in a
direct access unformatted file.

I hope this clarified the problem. :)
--
Asbjørn L. Johansen
asbjorjo@xxxxxxxxxxxx

.



Relevant Pages

  • Re: Portable record length
    ... So you HAVE to have a record end marker that you can look for. ... Since the data following your header is floating point data, ... In both cases the reading porgram opens the file as unformatted binary ...
    (comp.lang.fortran)
  • Re: __atoi64 not working correctly
    ... are missing from header files. ... programmers have to work to is the C89/90 standard, ... of the C compilers available are C99 compliant ... I want to determine the 'best' floating point type for my ...
    (comp.lang.c)
  • Re: What are Floating headers..Urgent please
    ... true Header precludes its floating. ... I *have*, however, seen reference to the ... But waht are Floating headers .. ...
    (microsoft.public.word.newusers)
  • Re: float confusion
    ... You don't use this header for anything, ... There is plenty on floating point problems in the FAQ, ...
    (comp.lang.c)
  • Re: format of unformatted file??
    ... it is not true that there "must" be some header or something. ... It is possible to put non-text data in a formatted file. ... The above heuristic applies only to sequential files. ... question might be direct access, then pretty much all bets are off. ...
    (comp.lang.fortran)