| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Sqfix problem |
BJ>> Ah.... That would explain it..... Yes, sizeof() may BJ>> not work in all environments now..... :( BS>> Well I just don't understand it, because it does BS>> normally work under Linux, maybe it's the arrays.. BJ> The problem is that sizeof() returns BJ> the number of bytes in BJ> memory. By default, structures are not packed. If the structure was BJ> packed, then sizeof() should have worked for reading and BJ> writing files. BS> Oh! I thought so, but I wasn't scure about it. I thought of an additional item..... Even a packed structure might round up the sizeof() to be a multiple of 4 or 8 bytes.... That would mean you would still need to specify the size via another means for reading and/or writing the packed structure.... I haven't tested this.... BJ> Wes has a define made to allow packing the structures BJ> under GCC but not on other compilers where the packing isn't needed. BS> It's needed for use with fx. OS/2 or Win32, BTW one of BS> my links told that the user.bbs from a Max/2 can't be BS> readed by Max/Linux Ok.... I haven't tried that yet. I will have either a conversion routine or that fixed before my BBS transitions from OS/2 to Linux..... BJ> Any structure that has more than one item (which it should or you BJ> wouldn't have used a structure), and has elements that are not an BJ> exact multiple of 4 or 8 bytes may get located on 4 (or 8) byte BJ> boundaries, resulting in unused bytes in the BJ> structures memory immage. BS> Ah! BJ> So, sizeof() is needed for memory copies, but fail when BJ> reading and/or writing binary files in these cases..... BS> I see :-) BS> Thanks for the explanation! You're welcome. Take care..... Bob Jones, 1:343/41 --- Maximus/2 3.01* Origin: Top Hat 2 BBS (1:343/41) SEEN-BY: 633/267 270 @PATH: 343/41 10/345 106/1 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™.