I am currently processing some data that is contained in several files in several different locations. The filenames contain descriptions of the data that I am working with, for example rect_W_7.2_H_3.8.txt
I am using the STL string class on MSVS to name the directories storing the files.
Expand|Select|Wrap|Line Numbers
- string drive="c:\\"
- string dir1="Output_Files\\";
- string dir2="Calculation_Data\\";
- string wg1="Rectangular\\";
- string loc=drive.append(dir1).append(dir2);
Expand|Select|Wrap|Line Numbers
- char file[100];
- sprintf_s(file,100,rect_W_%0.1f_H_%0.1f.txt,width,height);
- string current=loc;
- current.append(file);
- ofstream data.open(current);
I was wondering if there was a sprintf equivalent for strings. Since I will be working with files of variable name length I don't want to have to count into the filename and find the position of %0.1f and use insert every time.
Thanks