char *sBuffer=new char[20];
char * sStringStart = sBuffer;
long * plMsgStart = (long *) sBuffer;// what is this line doing
long i=500;
*plMsgStart = i // what is this line doing
Is the last line assigning 500 in char array ? but when i print the array i get garbage values
Hey guys below is the actual code and i encountered it when i was converting code from c++ to c#, this below code is part from c++ function, now why below function gives garbage values ?
char *sBuffer=new char[20];
char * sStringStart = sBuffer;
BSTR bsMsgBody= SysAllocString(L"Helo");
sStringStart+=4;
long * plMsgStart = (long *) sBuffer;
long l=50;
*plMsgStart=l;
sprintf(sStringStart, "%S", bsMsgBody);
printf("%S",sBuffer);