Click here to Skip to main content
15,894,546 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: access dynamically allocated structure Pin
Eugen Podsypalnikov31-Mar-10 2:37
Eugen Podsypalnikov31-Mar-10 2:37 
GeneralRe: access dynamically allocated structure Pin
Richard MacCutchan31-Mar-10 3:03
mveRichard MacCutchan31-Mar-10 3:03 
GeneralRe: access dynamically allocated structure Pin
Eugen Podsypalnikov31-Mar-10 3:09
Eugen Podsypalnikov31-Mar-10 3:09 
GeneralRe: access dynamically allocated structure Pin
rupeshkp72831-Mar-10 2:35
rupeshkp72831-Mar-10 2:35 
AnswerRe: access dynamically allocated structure Pin
Richard MacCutchan31-Mar-10 2:32
mveRichard MacCutchan31-Mar-10 2:32 
AnswerRe: access dynamically allocated structure Pin
CPallini31-Mar-10 2:36
mveCPallini31-Mar-10 2:36 
AnswerRe: access dynamically allocated structure Pin
KingsGambit31-Mar-10 2:36
KingsGambit31-Mar-10 2:36 
AnswerRe: access dynamically allocated structure Pin
Member 392263931-Mar-10 2:52
Member 392263931-Mar-10 2:52 
Don't you have a warning "warning C4091: 'typedef ' : ignored on left of 'CheckSumPair' when no variable is declared"?
Don't you have an error "error C2039: 'StrongCSString' : is not a member of 'CheckSumPair'"?
Type of CSPair[x] is CheckSumPair not CheckSumPair*, so you can't use "->", use "." instead.
Instruction "CSPair[x]->.weakcs" contains "->" and ".".
Why malloc? use the new operator instead:
CheckSumPair* CSPair = new CheckSumPair[10];

or better, if possible:
CheckSumPair CSPair[10];

And finally, you have to explain what are you trying to do with the two strncpy, maybe your code has to be like:
#define UINT32 unsigned int
#define INT32 int
#define UCHAR unsigned char

typedef struct
{
	UINT32 weakcs; // The weak, rolling Adler32 checksum.
	UCHAR StrongCS[10 + 1]; // including the string terminator
	UCHAR StrongCSString[10 + 1]; // including the string terminator
} CheckSumPair;

int main()
{
	CheckSumPair CSPair[10];

	for(int x = 0; x < 10; x++)
	{
		CSPair[x].weakcs = (UINT32)x+1;
		strncpy((char*)CSPair[x].StrongCS, "XYZ", 10);
		strncpy((char*)CSPair[x].StrongCSString, "CEDVCD", 10);
	}


	for(int x = 0; x < 10; x++)
	{
		printf("%d %s %s\n\n", CSPair[x].weakcs, CSPair[x].StrongCS, CSPair[x].StrongCSString);
	}

	return 0;
}

Questionerror C2664 Pin
002comp30-Mar-10 22:18
002comp30-Mar-10 22:18 
AnswerRe: error C2664 Pin
KingsGambit30-Mar-10 22:27
KingsGambit30-Mar-10 22:27 
GeneralRe: error C2664 Pin
002comp30-Mar-10 23:16
002comp30-Mar-10 23:16 
GeneralRe: error C2664 [modified] Pin
CPallini30-Mar-10 23:28
mveCPallini30-Mar-10 23:28 
AnswerRe: error C2664 Pin
Eugen Podsypalnikov31-Mar-10 0:00
Eugen Podsypalnikov31-Mar-10 0:00 
GeneralRe: error C2664 [modified] Pin
002comp31-Mar-10 1:54
002comp31-Mar-10 1:54 
GeneralRe: error C2664 Pin
KingsGambit30-Mar-10 23:34
KingsGambit30-Mar-10 23:34 
GeneralRe: error C2664 Pin
002comp31-Mar-10 1:35
002comp31-Mar-10 1:35 
GeneralRe: error C2664 Pin
KingsGambit31-Mar-10 2:03
KingsGambit31-Mar-10 2:03 
GeneralRe: error C2664 Pin
002comp31-Mar-10 2:14
002comp31-Mar-10 2:14 
GeneralRe: error C2664 Pin
KingsGambit31-Mar-10 2:18
KingsGambit31-Mar-10 2:18 
GeneralRe: error C2664 Pin
002comp31-Mar-10 2:28
002comp31-Mar-10 2:28 
GeneralRe: error C2664 Pin
Emilio Garavaglia30-Mar-10 23:57
Emilio Garavaglia30-Mar-10 23:57 
AnswerRe: error C2664 Pin
arun_pk30-Mar-10 23:26
arun_pk30-Mar-10 23:26 
QuestionCan the OnSelchange event of the combo box be accessed in any other page Pin
hansrajlal30-Mar-10 21:00
hansrajlal30-Mar-10 21:00 
AnswerRe: Can the OnSelchange event of the combo box be accessed in any other page Pin
CPallini30-Mar-10 21:23
mveCPallini30-Mar-10 21:23 
QuestionTree View control - Coloum rearrange Pin
arun_pk30-Mar-10 20:18
arun_pk30-Mar-10 20:18 

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.