i have a set of strings
"C:\test\abc\file1.dat"
"C:\test\test2\test3\file1.dat"
and I need to turn it into a filename -
"test_abc.dat"
"test_test2_test3.dat"
I have written code to produce the output required, but it doesn't remove the filename from the end of the original string.
char* tempString = temp_filename.c_str();
for (int x = 3; x < strlen(tempString); x++)
{
if(tempString[x] == '\\')
FileName += "_";
else
FileName += tempString[x];
}
How can I adapt this code so that it ignores the filename and adds only the folder names to the new filename?
Thanks
"C:\test\abc\file1.dat"
"C:\test\test2\test3\file1.dat"
and I need to turn it into a filename -
"test_abc.dat"
"test_test2_test3.dat"
I have written code to produce the output required, but it doesn't remove the filename from the end of the original string.
char* tempString = temp_filename.c_str();
for (int x = 3; x < strlen(tempString); x++)
{
if(tempString[x] == '\\')
FileName += "_";
else
FileName += tempString[x];
}
How can I adapt this code so that it ignores the filename and adds only the folder names to the new filename?
Thanks