Click here to Skip to main content
15,902,879 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Download ActiveX Pin
Iain Clarke, Warrior Programmer15-Jul-03 5:44
Iain Clarke, Warrior Programmer15-Jul-03 5:44 
GeneralRe: Download ActiveX Pin
Ryan Binns15-Jul-03 5:52
Ryan Binns15-Jul-03 5:52 
GeneralRe: Download ActiveX Pin
Iain Clarke, Warrior Programmer15-Jul-03 6:11
Iain Clarke, Warrior Programmer15-Jul-03 6:11 
GeneralRe: Download ActiveX Pin
Ryan Binns15-Jul-03 14:44
Ryan Binns15-Jul-03 14:44 
QuestionIs there any way to get this to work CString??? Pin
johnstonsk15-Jul-03 4:31
johnstonsk15-Jul-03 4:31 
AnswerRe: Is there any way to get this to work CString??? Pin
Ryan Binns15-Jul-03 5:05
Ryan Binns15-Jul-03 5:05 
GeneralRe: Is there any way to get this to work CString??? Pin
johnstonsk15-Jul-03 5:21
johnstonsk15-Jul-03 5:21 
GeneralRe: Is there any way to get this to work CString??? Pin
Ryan Binns15-Jul-03 5:48
Ryan Binns15-Jul-03 5:48 
At their core, strings are an array of characters. The string "Hello" has 5 characters (plus a terminating NULL character), so it will need a 6-character array.

Your Names array is declared as char Names[45], which means that it holds 45 characters, ie one string that can be up to [edit]44[/edit] characters long. If you are wanting to store more than one string, this won't work - an array of chars can only store one string.

To store multiple strings you'll need to use a 2-dimensional array - an array of arrays of characters (think about it, it does make sense Smile | :) )

I think you're wanting to store 45 strings. If each string is at most 10 characters long, then you'll need to declare Names as
char Names[45][11];
This is an array that holds 45 arrays of 11 characters, ie. it holds 45 strings that are up to 10 characters long each (remember the terminating NULL?). You'll have to work out how big to make the arrays to fit your strings (change the 11 to whatever is necessary to fit the string in). To write to these strings, use the code
strcpy(TSimHeader_arr[0].Names[0], name.c_str());
strcpy(TSimHeader_arr[0].Names[1], name.c_str());
// etc...
strcpy(TSimHeader_arr[0].Names[44], name.c_str());
To display the strings, use
cout << TSimHeader_arr[0].Names[0] << endl;
cout << TSimHeader_arr[0].Names[1] << endl;
// etc...
Hope this helps,

Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

GeneralRe: Is there any way to get this to work CString??? Pin
johnstonsk15-Jul-03 6:11
johnstonsk15-Jul-03 6:11 
GeneralRe: Is there any way to get this to work CString??? Pin
David Crow15-Jul-03 7:34
David Crow15-Jul-03 7:34 
GeneralRe: Is there any way to get this to work CString??? Pin
John M. Drescher15-Jul-03 7:59
John M. Drescher15-Jul-03 7:59 
GeneralRe: Is there any way to get this to work CString??? Pin
Ryan Binns15-Jul-03 14:40
Ryan Binns15-Jul-03 14:40 
GeneralRe: Is there any way to get this to work CString??? Pin
johnstonsk15-Jul-03 15:20
johnstonsk15-Jul-03 15:20 
AnswerRe: Is there any way to get this to work CString??? Pin
Shay Harel15-Jul-03 7:54
Shay Harel15-Jul-03 7:54 
AnswerRe: Is there any way to get this to work CString??? Pin
John M. Drescher15-Jul-03 8:03
John M. Drescher15-Jul-03 8:03 
GeneralRegistry values of an external PC Pin
Anonymous15-Jul-03 4:21
Anonymous15-Jul-03 4:21 
GeneralRe: Registry values of an external PC Pin
basementman15-Jul-03 4:27
basementman15-Jul-03 4:27 
GeneralAdjusting the overall contrast and brightness Pin
oliver.hu15-Jul-03 4:19
oliver.hu15-Jul-03 4:19 
GeneralRe: Adjusting the overall contrast and brightness Pin
Ryan Binns15-Jul-03 5:08
Ryan Binns15-Jul-03 5:08 
GeneralRe: Adjusting the overall contrast and brightness Pin
oliver.hu15-Jul-03 7:31
oliver.hu15-Jul-03 7:31 
GeneralRe: Adjusting the overall contrast and brightness Pin
John M. Drescher15-Jul-03 8:06
John M. Drescher15-Jul-03 8:06 
GeneralCreate CEdit dynamicly Pin
dzenan15-Jul-03 3:06
dzenan15-Jul-03 3:06 
GeneralRe: Create CEdit dynamicly Pin
Cedric Moonen15-Jul-03 3:44
Cedric Moonen15-Jul-03 3:44 
GeneralRe: Create CEdit dynamicly Pin
dzenan15-Jul-03 4:02
dzenan15-Jul-03 4:02 
GeneralRe: Create CEdit dynamicly Pin
Cedric Moonen15-Jul-03 4:19
Cedric Moonen15-Jul-03 4:19 

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.