Click here to Skip to main content
15,916,693 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Hide window from taskbar and alt+tab window Pin
Perspx18-Jul-07 7:19
Perspx18-Jul-07 7:19 
GeneralRe: Hide window from taskbar and alt+tab window Pin
David Crow18-Jul-07 7:22
David Crow18-Jul-07 7:22 
GeneralRe: Hide window from taskbar and alt+tab window Pin
Perspx18-Jul-07 7:23
Perspx18-Jul-07 7:23 
GeneralRe: Hide window from taskbar and alt+tab window Pin
James R. Twine18-Jul-07 7:24
James R. Twine18-Jul-07 7:24 
QuestionRe: Hide window from taskbar and alt+tab window Pin
David Crow18-Jul-07 7:19
David Crow18-Jul-07 7:19 
AnswerRe: Hide window from taskbar and alt+tab window Pin
Perspx18-Jul-07 7:21
Perspx18-Jul-07 7:21 
AnswerRe: Hide window from taskbar and alt+tab window Pin
James R. Twine18-Jul-07 7:25
James R. Twine18-Jul-07 7:25 
QuestionClass structure with character array Pin
bsharp5218-Jul-07 5:45
bsharp5218-Jul-07 5:45 

Greetings,

I am very new to C++ and after many searches I am unable to figure out how to set the values of my array containing a character string.

class DataStruct
{
public:
char *mName;
char mInitial;
int mId;
int mAge;
int mDay;


DataStruct(char *Def_mName = "Paddy", char Def_mInitial = 'A' , int Def_mId = 1, int Def_mAge = 1, int Def_mDay = 1)
{
cout << endl << "Constructor Called ";
mName = new char [ strlen(Def_mName) + 1 ];
strcpy_s (mName, strlen(Def_mName) + 1, Def_mName);
mInitial = Def_mInitial;
mId = Def_mId;
mAge = Def_mAge;
mDay = Def_mDay;
}

When trying to use:

DataStruct data1[2] = { ("Andy",'A',1,20,30), ("Andy",'A',1,20,30 )};

I get the error:
error C2440: 'initializing' : cannot convert from 'int' to 'DataStruct'

Clearly I am not understanding somthing correctly either about strings or pointers, I am trying not to use specific string lengths if possible in this scenario.


Please can someone tell me what command I should be using to create this array, also if possible I would like to dynamicaly create the array data1 using new if anyone would be kind enough to show that example too.

Kind regards,

BS


AnswerRe: Class structure with character array Pin
Mark Salsbery18-Jul-07 5:58
Mark Salsbery18-Jul-07 5:58 
GeneralRe: Class structure with character array Pin
bsharp5218-Jul-07 6:21
bsharp5218-Jul-07 6:21 
GeneralRe: Class structure with character array Pin
Mark Salsbery18-Jul-07 6:58
Mark Salsbery18-Jul-07 6:58 
GeneralRe: Class structure with character array Pin
John R. Shaw19-Jul-07 2:38
John R. Shaw19-Jul-07 2:38 
GeneralRe: Class structure with character array Pin
Michael Dunn18-Jul-07 7:16
sitebuilderMichael Dunn18-Jul-07 7:16 
GeneralRe: Class structure with character array Pin
Mark Salsbery18-Jul-07 7:19
Mark Salsbery18-Jul-07 7:19 
QuestionHow to handle click event on icon.... Pin
Super Hornet18-Jul-07 5:37
Super Hornet18-Jul-07 5:37 
AnswerRe: How to handle click event on icon.... Pin
Mark Salsbery18-Jul-07 6:03
Mark Salsbery18-Jul-07 6:03 
GeneralRe: How to handle click event on icon.... Pin
Super Hornet18-Jul-07 6:43
Super Hornet18-Jul-07 6:43 
GeneralRe: How to handle click event on icon.... Pin
Mark Salsbery18-Jul-07 6:51
Mark Salsbery18-Jul-07 6:51 
GeneralRe: How to handle click event on icon.... Pin
Hans Dietrich18-Jul-07 8:31
mentorHans Dietrich18-Jul-07 8:31 
GeneralRe: How to handle click event on icon.... Pin
Mark Salsbery18-Jul-07 8:41
Mark Salsbery18-Jul-07 8:41 
GeneralRe: How to handle click event on icon.... Pin
Mark Salsbery18-Jul-07 14:42
Mark Salsbery18-Jul-07 14:42 
GeneralRe: How to handle click event on icon.... Pin
Hans Dietrich18-Jul-07 19:16
mentorHans Dietrich18-Jul-07 19:16 
GeneralRe: How to handle click event on icon.... Pin
Mark Salsbery18-Jul-07 19:51
Mark Salsbery18-Jul-07 19:51 
AnswerRe: How to handle click event on icon.... Pin
Hans Dietrich18-Jul-07 6:10
mentorHans Dietrich18-Jul-07 6:10 
GeneralRe: How to handle click event on icon.... Pin
Super Hornet18-Jul-07 6:38
Super Hornet18-Jul-07 6:38 

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.