将文件路径以"\"隔开,这货搞了我一小时...C++返回一维数组,字符串数组还是要再看看
void fileNameDiscompose(string road,string s_array[])
{
int block = ;
//string s_array[30]; //局部变量,如果使用return外面得不到想要的
string tmp = "";
for(int i = ; i < road.length(); i++){
if(road[i] != '\\'){
tmp += road[i];
}
else{
s_array[block] = tmp;
tmp = "";
block++;
}
}
s_array[block] = tmp;
}