Solved

Calling a Function

Posted on 2006-11-29
6
243 Views
Last Modified: 2013-11-20
Hi guys,

I have this function:

ExecuteScriptFunction(const CString strFunc,  const CStringArray& paramArray)


How would I call it?


String value, Array
String value, lots of string values


?


Cheers!
0
Comment
Question by:Cyber-Drugs
6 Comments
 
LVL 30

Accepted Solution

by:
Axter earned 250 total points
ID: 18038239
Hi Cyber-Drugs,
> How would I call it?

You need a CStringArray object to call this function.

Example:
CStringArray MyStrArray;
//Then populate above array

//Then call the function
ExecuteScriptFunction("foofoo", MyStrArray);



David Maisonave (Axter)
Cheers!
0
 
LVL 4

Author Comment

by:Cyber-Drugs
ID: 18038312
Sorry Axter,

I suppose what I meant was...

How do I populate a CStringArray?


Cheers!
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 18038417
why not to use VARIABLE ARGUMENT FUNCTION with which you can pass unlimited no. (varaible) of arguments to function....just like printf().. as you know you may pass any no. of arguments to printf().. you may also have such type of function...

so that in function itself you may pass any no. strings  as parameters like :
ExecuteScriptFunction(const CString strFunc, strArg1,strArg2,strArg3......)

Look here for how to declare and define them :
http://www.codeproject.com/cpp/argfunctions.asp
http://www.codeguru.com/cpp/cpp/cpp_mfc/functions/article.php/c4025/

-MAHESH
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 22

Expert Comment

by:mahesh1402
ID: 18038461
more simple example related to variable argument is here :
http://www.codeproject.com/cpp/C___Variable_Arguments.asp

-MAHESH
0
 
LVL 4

Author Comment

by:Cyber-Drugs
ID: 18038488
Hi Mahesh,

Thank you for all the detailed links, and I will be reading them to learn a few new tricks, but for this question I'm basically looking for something I can cut and paste into C++ to test if the function works properly...

As you helped write the function, maybe you could show me how to use it?

Cheers!
0
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 250 total points
ID: 18039223
CStringArray ar;

ar.Add("string1");
ar.Add("string2");
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
paragon account problem 9 96
Error on moodle after upgrade 3 106
dog bark java program 15 82
scoreUp challenge 14 48
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now