Click here to Skip to main content
16,005,552 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Stupid Algebra Question Pin
toxcct10-Mar-07 2:56
toxcct10-Mar-07 2:56 
AnswerRe: Stupid Algebra Question Pin
Stephen Hewitt10-Mar-07 17:11
Stephen Hewitt10-Mar-07 17:11 
AnswerRe: Stupid Algebra Question Pin
cp987610-Mar-07 17:38
cp987610-Mar-07 17:38 
Questionstring arguments Pin
Kiran Pinjala10-Mar-07 0:05
Kiran Pinjala10-Mar-07 0:05 
AnswerRe: string arguments [modified] Pin
Newbie0010-Mar-07 0:10
Newbie0010-Mar-07 0:10 
GeneralRe: string arguments Pin
Kiran Pinjala10-Mar-07 1:09
Kiran Pinjala10-Mar-07 1:09 
GeneralRe: string arguments Pin
Waldermort10-Mar-07 1:28
Waldermort10-Mar-07 1:28 
GeneralRe: string arguments Pin
Newbie0010-Mar-07 2:30
Newbie0010-Mar-07 2:30 
I don't think there is possibility to do something like you want at runtime. Besides what if number of strings you want to pass to the function==10,100 or more?? Do you really want to define function like: AddItem("one","two",.........................."ten"..."hundred)?

I think this is very bad idea. Why don't you choose my solution which I gave you earlier?

If you want to use char instead of string you can do this like this:

char **StrArr;<br />
int Size1=30,Size2=10 //lets say you want to keep 30 strings for <br />
//example<br />
StrArr= new char*[30]; //define array of 30 pointers to char so 30 <br />
//strings <br />
<br />
for(int i=0;i<30;i++)<br />
 StrArr[i]=new char[Size2]; //allocating memo for each string which <br />
   //length==10

after this you can write strings into Str[][] array and pass whole array into function giving the Size1 and Size2 as additional parameters near the parameter: char **StrToPass

If you want to use your idea you can do something like this for lets say finite and small set of strings, use "default parameters" (I don't know if I call this properly in English):

void function (char *Str1="",char *Str2="",char *Str3="",char *Str4="") /*f. declaration with default parameters set to ""*/<br />
<br />
//now if you want to run the function you can call it like this:<br />
function("blablaba"); //that means only first parameter will <br />
//contain "blablaba" string and remaining 3 will contain "" <br />
//string

AnswerRe: string arguments Pin
Mark Salsbery10-Mar-07 7:09
Mark Salsbery10-Mar-07 7:09 
Questionauto run a mfc program Pin
prathuraj9-Mar-07 22:30
prathuraj9-Mar-07 22:30 
AnswerRe: auto run a mfc program [modified] Pin
Eytukan9-Mar-07 23:54
Eytukan9-Mar-07 23:54 
GeneralRe: auto run a mfc program--but what i need is Pin
prathuraj10-Mar-07 0:07
prathuraj10-Mar-07 0:07 
GeneralRe: auto run a mfc program--but what i need is Pin
Waldermort10-Mar-07 0:25
Waldermort10-Mar-07 0:25 
GeneralRe: auto run a mfc program--but what i need is Pin
prathuraj10-Mar-07 0:41
prathuraj10-Mar-07 0:41 
GeneralRe: auto run a mfc program--but what i need is Pin
Waldermort10-Mar-07 0:42
Waldermort10-Mar-07 0:42 
GeneralRe: auto run a mfc program--but what i need is Pin
jeepoo10-Mar-07 2:34
jeepoo10-Mar-07 2:34 
GeneralRe: auto run a mfc program--but what i need is Pin
Waldermort10-Mar-07 3:10
Waldermort10-Mar-07 3:10 
QuestionRe: auto run a mfc program--but what i need is Pin
Rajesh R Subramanian11-Mar-07 3:03
professionalRajesh R Subramanian11-Mar-07 3:03 
QuestionEmail without SMTP Pin
kk.tvm9-Mar-07 21:21
kk.tvm9-Mar-07 21:21 
QuestionRe: Email without SMTP Pin
Hamid_RT11-Mar-07 5:59
Hamid_RT11-Mar-07 5:59 
Questionwindows autorun Pin
jeepoo9-Mar-07 20:23
jeepoo9-Mar-07 20:23 
AnswerRe: windows autorun Pin
G Haranadh9-Mar-07 21:44
G Haranadh9-Mar-07 21:44 
GeneralRe: windows autorun [modified]-- help me please Pin
jeepoo9-Mar-07 21:58
jeepoo9-Mar-07 21:58 
GeneralRe: windows autorun [modified]-- help me please Pin
G Haranadh9-Mar-07 23:08
G Haranadh9-Mar-07 23:08 
GeneralRe: windows autorun [modified]-- but Pin
jeepoo9-Mar-07 23:32
jeepoo9-Mar-07 23:32 

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.