|
-
May 12th, 1999, 12:42 PM
#1
Size of Struct problem???
Hi,
Environment : VC++,WinNT
I need to write data in a structure to a file.Iam unable to find the exact size of structure. Please see the folowing code,
struct data
{
int age;
char unit;
CString name;
};
Iam using sizeof operator to find the size of the above structure which gives me 12 bytes. But if u look at the structure fields,
size of int =4 bytes
size of char=1 byes
size of CString =4 bytes.
The Actual total size of structure fields is 9 bytes but the size of operator gives me size of struct as 12 bytes.
How to get the actual size of the structure?
Thanx in advance.
NMNB
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|