Sorry to ask this here, not really a lingo question. I think I have this
right but I would like to check with some of you guys.

I am sitting on a Mac writing my own conversion tool for a windows-only
non-text file format using fileIO and actually it is going pretty well. I
can read bytes and Cstrings < 255 chars without any trouble, but as you
may know, shorts and longs are represented by 2 and 4 bytes respectively,
so there is room for confusion which order the bytes come in. I 

AFAIK this relates to 'endianness' or something.

Now, here's my question. Hopefully with a quick answer:

When I am reading a file byte by byte from the start of the file, and want
to read four bytes as a long or two bytes as a short, is the first byte I
read the high byte or the low byte in these cases?

I presume that because it's a file originating on Wintel - little endian -
I should treat the first byte as the least significant one - right?

Finally, let me know if I have got this right: - Cstrings have the length
of the string at the beginning of the file and have no special termination
char, Pascal strings have no length specifier, but terminate with a null
char. 

I'm pretty impressed with fileIO being able to do this stuff. When I get
my code working I will be happy to share it. I have a parent script
wrapper for fileIO featuring handlers like 'readByte()' 'readCstring()'
and (coming soon with your help) 'readShort()' and 'readLong()'.

Brennan
[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email [EMAIL 
PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping 
with programming Lingo.  Thanks!]

Reply via email to