Basic Data input question

Hummm … what about:

ofstream myfile; string filename = ... info coming from "inputed filename as earlier" ... ; myfile.open (filename.c_str()); myfile << "Writing this to a file.\n"; myfile.close();

Philippe

[quote=“pcanal”]Hummm … what about:

ofstream myfile; string filename = ... info coming from "inputed filename as earlier" ... ; myfile.open (filename.c_str()); myfile << "Writing this to a file.\n"; myfile.close();

Philippe[/quote]

hat name will that be saved as? will it be .txt?

it will be what ever name you store in the variable ‘filename’.

Philippe

You can use bash redirection :
root MyMacro.C >> output.txt
take a look here :
tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html

I see a problem in the plan that i had. i input the filename as “FileA.ntup.root” and i want the output file to be saved as “FileA.txt”. any idea’s on how to do that??

Yes you have to manipulate the string a little bit (find the first dot, remove the end of the string, append .txt).
I strongly recommend that you re-review your favorite C++ book/tutorials/course or find an experienced C++ developer close to you to review those kind of issue.

Cheers,
Philippe.