| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: Big endian machines |
Hi Bo! :-)
BS> struct _pkthdr
BS> {
BS> sword orig_node; /* originating node */
BS> sword dest_node; /* destination node */
BS> } __attribute__((packed, aligned(2)));
That's not packed, that's aligned on two byte boundaries - but that
shouldn't matter here.
BS> The structure contains most words and a couple of bytes.
What is an sword supposed to be? I'd stick to standard names.
BS> It's beeing readed by
BS> read(fp, &pkthdr, sizeof(struct _pkthdr));
BS> Should I read every single variable in the structure to get it
BS> working?
The main question is whether you know the endianness of the input or can
easily find it out?
Reading the full structure at once is okay. After that, you can convert all
the values that need to be byteswapped/converted.
Ciao
Pascal
--- Msged/LNX 6.1.1
* Origin: let fun a b c d = b (c,d) in a op < 17 end 23 (1:153/401.2)SEEN-BY: 633/267 270 @PATH: 153/401 307 140/1 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.