I've seen several responses that go into more detail, but to
directly answer the specific questions asked...
Joerg Stiller writes:
> there seems to be a tradeoff between formatted and unformatted IO concerning
> speed and portability. Do you know,
> - what speed-up can be expected by using unformatted instead of
> formatted read/write
As a rough approximation, a lot. My rule of thumb is about a factor
of 10, but that is a *VERY* rough approximation, not really much more
precise than the "a lot".
> - wether there is a standard way to convert between Big and Little
> Endian formats?
The simple direct answer is "no". There are some nonstandard
compiler-specific ways, but nothing standard. If the compiler doesn't
support something, it can be pretty tricky because you likely can't
even read in the records at all without trickery. That's because
the record length fields in the headers will also be btye-swapped
as well as the data. In this case, you are reduced to reading in
the raw byte stream and doing the record management yourself by
hand. This is simple enough in principle, but quite tedious.
--
Richard Maine | Good judgment comes from experience;
[log in to unmask] | experience comes from bad judgment.
| -- Mark Twain
|