可以对字符串路径进行分割:
#include <stdio.h>
#include <windows.h>
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
char* path="C:\\服务程序\\MDTest\\地形\\tileset.json";
char drive[5];
char dir[100];
char filename[100];
char fileext[10];
_splitpath(path,drive,dir,filename,fileext);
cout<<"filepath: "<<path<<endl
<<"drive: "<<drive<<endl
<<"dir: "<<dir<<endl
<<"filename: "<<filename<<endl
<<"fileext: "<<fileext<<endl;
system("pause");
return 0;
}