Morning all,
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.
Thus far I have been using sprintf_s to open the file that I want to work on, for example
This works fine and I havn't had any problems with it.
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
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.
Code:
string drive="c:\\" string dir1="Output_Files\\"; string dir2="Calculation_Data\\"; string wg1="Rectangular\\"; string loc=drive.append(dir1).append(dir2);
Code:
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
Comment