One little endian question
Jeff Harrison
jeffaharrison at yahoo.com
Sun Mar 2 13:19:37 PST 2008
--- "Brian K. White" <brian at aljex.com> wrote:
> Maybe you can perform an empirical test.
>
> Ship the app with a file that has a known value if
> read on little-endian.
> Read the file and test if the value is what you
> expect.
> You can do all that behind the scenes as part of a
> setup procedure.
>
I don't think this would work without some additional
test for endianness.
> You could probably create the test data on the fly
> even.
> Use file i/o or something to write out an explicit
> string of bytes that
> forms a valid structure of some sort in
> little-endian
>
Oh, very good! I think you are on to something here.
All I would need to do would be to write a free record
in a filepro file, then examine the 20 byte header for
the @cd and make sure it is today's date - then store
the appropriate endianness that I used to get the
valid date.
> The test data/file probably doesn't necessarily have
> to be a filepro 20 byte
> header.
> It can be anything that filepro will read according
> to the endianness of the
> platform.
> Is ordinary data in files subject to that? ordinary
> strings?
I think it is only an issue with binary data - not
strings.
>... maybe you don't
> even have to write a file, just create a string and
> then interpret it with
> some filepro function? Thats desireable for another
> reason, if you ship the
> app with a special test file, you'd have to watch
> out for xfer having
> "fixed" your test file!
>
Not an issue if I create the data on the fly as you
mentioned above.
[snip]
>... I dare say none of
> us has any endianness tests in our normal apps and
> we survived this long :)
>
> --
Yes, apparently I am going where no man has gone
before :-)
Thanks!
Jeff Harrison
jeffaharrison at yahoo.com
Author of JHExport and JHImport. The fastest and
easiest ways to generate filepro exports and imports.
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
More information about the Filepro-list
mailing list