-
plodata<<
I am writing data to a file but want to include an integer (i) in the title of the file. How can I go about this?
i = 0, 1, 2...
ofstream plotdata("../Data/supersonic_jet(i).vtk", ios::out);
filename:
supersonic_jet0.vtk
supersonic_jet1.vtk
supersonic_jet2.vtk
etc
-
Use a stringstream to build the filename.
-
can you give me an example please?
-
Say i want to name the file name after string s. How do I go about this?
string s = "file1.vtk"
ofstream plotdata("../Data/(s)", ios:out);
-
One possible way:
Code:
string s = "file1.vtk";
ofstream plotdata( ("../Data/"+s).c_str() );
-