Google was not my friend, this time, I didn't find anything regaurding fopen and it's support of it.
I know what endianness is, i wasn't asking that. In fact, in between the time i posted that, I already put in the swapping functions and whatnot. I was just wondering if fopen had native support.
And for text files, rofl. text files are also a really INefficient way to store things. Not possible in this case.
btw, I'm writing something that will import 3DS models and output a Palm Database to be read by Palm game. The Palm OS was originally written for motorola 68k, which is big endian, but not runs on ARM, for Palm OS 5+, and i'm writing an ARMlet/PNO that does all my work. I've had to deal with endian issues from the start, it's no big deal.
For example, the matlab fopen takes a format arguement, and you can specify big endian or little endian.
Code:
#define ByteSwap16(n) \
( ((((unsigned int) n) << 8) & 0xFF00) | \
((((unsigned int) n) >> 8) & 0x00FF) )
#define ByteSwap32(n) \
( ((((unsigned long) n) << 24) & 0xFF000000) | \
((((unsigned long) n) << 8) & 0x00FF0000) | \
((((unsigned long) n) >> 8) & 0x0000FF00) | \
((((unsigned long) n) >> 24) & 0x000000FF) )
////////////// Endian swaping wrapper functions //////////
inline void fwrite32(UInt32 blah, FILE *f)
{
UInt32 item = ByteSwap32(blah);
fwrite(&item, 4, 1, f);
}
inline void fwrite16(UInt16 blah, FILE *f)
{
UInt16 item = ByteSwap16(blah);
fwrite(&item, 2, 1, f);
}