Click here to Skip to main content
15,905,563 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCStdioFile WriteString (Unicode Strings) failing? Pin
kiranin17-Jan-09 7:10
kiranin17-Jan-09 7:10 
QuestionRe: CStdioFile WriteString (Unicode Strings) failing? Pin
David Crow17-Jan-09 7:43
David Crow17-Jan-09 7:43 
AnswerRe: CStdioFile WriteString (Unicode Strings) failing? Pin
kiranin17-Jan-09 7:49
kiranin17-Jan-09 7:49 
GeneralRe: CStdioFile WriteString (Unicode Strings) failing? Pin
Iain Clarke, Warrior Programmer18-Jan-09 23:38
Iain Clarke, Warrior Programmer18-Jan-09 23:38 
AnswerRe: CStdioFile WriteString (Unicode Strings) failing? Pin
Loreia17-Jan-09 7:57
Loreia17-Jan-09 7:57 
GeneralRe: CStdioFile WriteString (Unicode Strings) failing? Pin
Loreia17-Jan-09 7:59
Loreia17-Jan-09 7:59 
AnswerRe: CStdioFile WriteString (Unicode Strings) failing? Pin
Alexandre GRANVAUD15-Feb-10 5:34
Alexandre GRANVAUD15-Feb-10 5:34 
QuestionWizard Dialogs (Save Dialog state) ? Pin
kiranin17-Jan-09 6:42
kiranin17-Jan-09 6:42 
Questioninteract between 2 process - urgent!!!! Pin
tran hung thien17-Jan-09 6:17
tran hung thien17-Jan-09 6:17 
Answerwe don't do homework Pin
Luc Pattyn17-Jan-09 6:26
sitebuilderLuc Pattyn17-Jan-09 6:26 
JokeRe: we don't do homework Pin
CPallini17-Jan-09 6:45
mveCPallini17-Jan-09 6:45 
JokeRe: we don't do homework Pin
Hamid_RT18-Jan-09 19:21
Hamid_RT18-Jan-09 19:21 
GeneralRe: we don't do homework Pin
Garth J Lancaster17-Jan-09 15:23
professionalGarth J Lancaster17-Jan-09 15:23 
GeneralRe: we don't do homework Pin
tran hung thien18-Jan-09 0:32
tran hung thien18-Jan-09 0:32 
GeneralRe: we don't do homework Pin
RedSonja19-Jan-09 3:51
RedSonja19-Jan-09 3:51 
GeneralRe: interact between 2 process - urgent!!!! Pin
CPallini17-Jan-09 6:50
mveCPallini17-Jan-09 6:50 
GeneralRe: interact between 2 process - urgent!!!! Pin
Luc Pattyn17-Jan-09 7:34
sitebuilderLuc Pattyn17-Jan-09 7:34 
GeneralRe: interact between 2 process - urgent!!!! Pin
CPallini17-Jan-09 9:22
mveCPallini17-Jan-09 9:22 
GeneralRe: interact between 2 process - urgent!!!! Pin
Luc Pattyn17-Jan-09 9:32
sitebuilderLuc Pattyn17-Jan-09 9:32 
GeneralRe: interact between 2 process - urgent!!!! Pin
CPallini17-Jan-09 9:43
mveCPallini17-Jan-09 9:43 
GeneralRe: interact between 2 process - urgent!!!! Pin
Luc Pattyn17-Jan-09 9:55
sitebuilderLuc Pattyn17-Jan-09 9:55 
GeneralRe: interact between 2 process - urgent!!!! Pin
Luc Pattyn17-Jan-09 9:57
sitebuilderLuc Pattyn17-Jan-09 9:57 
JokeRe: interact between 2 process - urgent!!!! Pin
CPallini17-Jan-09 22:30
mveCPallini17-Jan-09 22:30 
QuestionProblem with record reading from a binary file Pin
Umer Aziz17-Jan-09 1:05
Umer Aziz17-Jan-09 1:05 
I have compiled the following program in MS Visual C++ 6.0
Its strange for me to know the output of the program.

#include <stdio.h>

struct struct1
{
int i;
};


struct struct2
{
char s[2];
};

struct struct3
{
char s[2];
int i;
};


struct struct4
{
char s1[2];
int i;
char s2[2];
};

struct struct5
{
int i;
char s2[2];
};


int main()
{
printf("\nSize of Structure 1 = %d",sizeof(struct struct1));
printf("\nSize of Structure 2 = %d",sizeof(struct struct2));
printf("\nSize of Structure 3 = %d",sizeof(struct struct3));
printf("\nSize of Structure 4 = %d",sizeof(struct struct4));
printf("\nSize of Structure 5 = %d",sizeof(struct struct5));

printf("\n\n");

return 0;
}



The size shown by the program for structure 1 and 2 is OK. But result of structure 3,4 and 5 is mind f***ing. Why; when I declare the integer and charector in the same structer, the compiler add 2 extra bytes?

Actually i am reading the data from a binary file using the structure. But this thing has made me fool from last 2
days.

If anyone knows the reason or solution of that problem, please reply.

----------------------Output of the program-----------------
Size of Structure 1 = 4
Size of Structure 2 = 2
Size of Structure 3 = 8
Size of Structure 4 = 12
Size of Structure 5 = 8
AnswerRe: Problem with record reading from a binary file Pin
Garth J Lancaster17-Jan-09 1:10
professionalGarth J Lancaster17-Jan-09 1:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.