TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ALL
from: LEE KIRBY
date: 1997-12-23 21:57:00
subject: Extra bytes

I'm very new to C++, and can't figure out why I get two extra bytes when I 
write this structure to a file:
struct fidoMsg::fMsg {
  char msgFrom[ 36 ];
  char msgTo[ 36 ];
  char msgSubj[ 72 ];
  char msgDate[ 20 ];
  ushort timesRead;
  sshort toNode;
  sshort fromNode;
  ushort cost;
  sshort fromNet;
  sshort toNet;
  time_t dateWritten;
  time_t dateArrived;
  ushort reply;
  ushort attr;
  ushort unreply;
} msg;
...via:
  
outfile.write( msg, sizeof( fMsg ) );
The way I count, this structure should be only 190 bytes, but if I do a
sizeof( fMsg), it reports 192!
Thanks for any insight!
--- Msged/386 4.20 beta 2
---------------
* Origin: Sirius BBS * Portland, OR (503) 291-1908 * V.34 (1:105/24)

SOURCE: echomail via exec-pc

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™.