I am developing an MFC Interface with Visual Studio, but the output is not as it should. I am using the same code as the on used in codeblocks but the output here is different and i think it's because of the format. What is the correct way to enter 'e' and 'd' in my 'IDC_Values' ? I searched online but couldn't find much about MFC
int e[100], d[100];
CString Text;
Text.Format((LPCWSTR)L"%d \t%d", e, d);
SetDlgItemText(IDC_Values, Text);
eanddare arrays, so printing them with the%dformat specifier is wrong. What are you trying to achieve? Print the 1st element of the arrays? Print all elements of the arrays? Also you don't needd the(LPCWSTR)cast before the format string. What isIDC_Values? The id of an edit control, of a static or...? Show an example of values ineand indand the text you want to put inIDC_Values(what ever controlIDC_Valuesis). - JabberwockyLPCWSTRcast -- never cast string types, even though it may "work". If a string can't live by itself without casts being applied, the code could and should be considered wrong. Casting is a sign that you're trying to shut the compiler up about an error about differing string types. Instead, use the right type of string for the job. - PaulMcKenzieFormatknow how to format a series of numbers? A space in-between them? Two spaces? Carriage return? A pipe symbol? - PaulMcKenzie