Handling endianness in Tango's FileConduit

Nick Sabalausky a at a.a
Sat Oct 4 04:03:24 PDT 2008


I've been looking at the Tango docs, but I'm unclear on how IProtocol works, 
specifically in relation to endianness.

I see stuff about protocols and endianness in the docs, so I assume Tango 
provides a way to say "The file I'm reading/writing through this conduit 
uses X type of endieanness, so Tango, make sure that any shorts, ints, etc, 
that I read/write are adjusted to match the system's native endianness."  If 
so, how would I adjust the following to tell Tango "This file uses 
little-endian"?:

auto file = new FileConduit(infilename);
scope(exit) file.close();
auto input = new Reader(file.input);
// Load data through 'input'

BTW, A small side question: Tango's conduits don't have anything like 
"char[] readNullTerminatedString()", do they? It's trivial enough to 
implement, but I thought if it was there, I may as well just use it. (I 
don't think it is there though, right? No big deal, though, just wondering.) 




More information about the Digitalmars-d-learn mailing list