Reading values from file name

Hi,

is it possible to extract values from the name of the file?
For example, I have my file “output_1.05.txt” and want to access the value 1.05.

thanks!

TString

Sorry to bother you again, but I can’t get it working (beginner here). Suppose I habe three files (output_1.txt,output_2.txt, output_3.txt) which I want to read and after that I use the i-value. I tried the Data() function, but it’s not working, so for

[code]TString a1=“output_”;
TString a2=“i”;
TString a3=".txt";
char *a;
a=a2.Data();

for(int i=1;i<=3;i++){
cout << i<<" "<<a << endl;
//stuff, reading in
}[/code]

I only get

1 i 2 i 3 i

What am I doing wrong?

{ for (int i = 1; i <= 3; i++) { std::cout << i << " " << TString::Format("output_%i.txt", i) << std::endl; } }

Thank you very much, it’s working :slight_smile: