Click here to Skip to main content
15,917,642 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to serialize __int64 Pin
David Crow15-Jul-03 10:09
David Crow15-Jul-03 10:09 
GeneralRe: how to serialize __int64 Pin
Anonymous15-Jul-03 15:05
Anonymous15-Jul-03 15:05 
AnswerRe: how to serialize __int64 Pin
basementman15-Jul-03 10:21
basementman15-Jul-03 10:21 
QuestionConverting lines to polygons? Pin
cdsmith15-Jul-03 7:37
cdsmith15-Jul-03 7:37 
AnswerRe: Converting lines to polygons? Pin
John R. Shaw15-Jul-03 9:20
John R. Shaw15-Jul-03 9:20 
GeneralRe: Converting lines to polygons? Pin
Ryan Binns15-Jul-03 14:49
Ryan Binns15-Jul-03 14:49 
GeneralRe: Converting lines to polygons? Pin
cdsmith16-Jul-03 3:35
cdsmith16-Jul-03 3:35 
GeneralRe: Converting lines to polygons? Pin
John R. Shaw16-Jul-03 6:12
John R. Shaw16-Jul-03 6:12 
QuestionRotating a shape within a bounding rect? Pin
cdsmith15-Jul-03 7:35
cdsmith15-Jul-03 7:35 
AnswerRe: Rotating a shape within a bounding rect? Pin
Ryan Binns15-Jul-03 14:48
Ryan Binns15-Jul-03 14:48 
GeneralRe: Rotating a shape within a bounding rect? Pin
cdsmith16-Jul-03 3:40
cdsmith16-Jul-03 3:40 
GeneralRe: Rotating a shape within a bounding rect? Pin
Ryan Binns16-Jul-03 3:52
Ryan Binns16-Jul-03 3:52 
GeneralPipes and Child Process Pin
anqin15-Jul-03 7:26
anqin15-Jul-03 7:26 
GeneralDownload ActiveX Pin
Anonymous15-Jul-03 5:33
Anonymous15-Jul-03 5:33 
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 

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.