Calling a funtion from root

Hello again.

I am having troubbles in this situation:

I want to create some directories while in root.
I’ve tried calling the function mkdir() from inside root after including the file header “/sys/stat.h”, which is the file header when compiling in the ordinary way. But it says that this function is not defined in the current scope.
So, i have tried to call .mkdir, but, as i will create several directories, the argument for .mkdir must be root variable.

Is there any solution? Maybe calling another program or macro from root…

Thanks a lot.

You can try something like:

//—file jdir.C
void jdir() {
char cmd[100];
for (Int_t i=0;i<10;i++) {
sprintf(cmd,“mkdir mysubdir_%d”,i);
gSystem->Exec(cmd);
}
gSystem->Exec(“ls mysub*”);
}

root > .x jdir.C

Rene

Hi,

You can also call the equivalent function via gSystem:

Cheers,
Philippe.