Pass argc and argv to root

Hi everybody
i’m asking about passing parameter to main function by root ,which use argc and argv[]
i had tried things such as

my main function defined as

and my function defined

but alawys give error

note: candidate function not viable: requires 2 arguments, but 4 were provided int main(int argc , char* argv[])

what is the proper way to write the command , by example if you can
thanks all

I am afraid it is not possible to pass a variable size argument list to a ROOT macro.

You can use “stdarg”, I believe.
If you use ROOT 5, see also the CINT limitati.txt file.

[quote=“Pepe Le Pew”]You can use “stdarg”, I believe.
If you use ROOT 5, see also the CINT limitati.txt file.[/quote]
how can i do that ??
I tried several times but still cannot pass them to the function call
thanks

google.com/#q=stdarg+usage

With v6 (and hence c++11) you may have two other possibility.

One possibility is to declare your function to use variadic template arguments rather than argc and argv. See for example nerdparadise.com/forum/openmic/5712/

Another is to pass an initializer list (i.e. the following might work with v6 with your current macro, note the extra curly braces and explicitly count)

Cheers,
Philippe.

[quote=“pcanal”]With v6 (and hence c++11) you may have two other possibility.

One possibility is to declare your function to use variadic template arguments rather than argc and argv. See for example nerdparadise.com/forum/openmic/5712/

Another is to pass an initializer list (i.e. the following might work with v6 with your current macro, note the extra curly braces and explicitly count)

Cheers,
Philippe.[/quote]

The Idea is to pass arguments to the main function then it passes these arguments to another functions inside the main where these functions do the calculations.
"My Project Contains the main.C functions.C functions.h file1.C file1.h file2.C file2.h … "
the main call the functions.C
then the functions.C calls another functions in file1.C file2.C … and do the calculations
of course i’m using class and objects
How i Can do that??
thanks in advance

Hi,

[quote]the main call the functions.C
then the functions.C calls another functions in file1.C file2.C … and do the calculations
[/quote]Simply have the main.C have a #include statement for each of those files then have the code call the function as usual in C++.

Cheers,
Philippe.

[quote=“pcanal”]Hi,

[quote]the main call the functions.C
then the functions.C calls another functions in file1.C file2.C … and do the calculations
[/quote]Simply have the main.C have a #include statement for each of those files then have the code call the function as usual in C++.

Cheers,
Philippe.[/quote]
I had done that already but the problem that each functions use argc and argv so i’m obliged to use them in main
thanks

[quote]I had done that already but the problem that each functions use argc and argv so i’m obliged to use them in main[/quote]I am not sure I understand the problem (in first approx, just pass them along) … What did you actually (code samples) and how did it fail?