Passing an input into a macro from outside the macro

Hi everybody,

I’m new in the forum and a rookie in c++ and root. I guess my question is simple but I’m not able to solve it . I wrote a litte c++ macro for root which allows me to read a specific ascii file into a tree and a root file, creating a 2DProfile histo and to fit this histo. Now I have many many of these ascii files and I don’t want to change my little c-code everytime I have to use the macro for another ascii file. Is there some way to tell my macro to use a file that is given from outside like >macro.C ascii.dat? The file should than be used inside the macro like ‘command("[ascii.dat]")’

If anybody knows something, please tell me. It’s really annoying to stuck cause of such a little problem.

Thanks a lot,

Assuming a script file myscript.C with a function like
void myscript(const char* filename)
You can invoke this script in several ways

1- from the Root prompt

2- from another script

3- from the shell

see more examples in the first pages of the Users guide


Works well, thanks