使用vs2010用GetFilePath()获取打开的文件路径,然后再做修改后新建文件,但是发现fopen出错,查错后发现绝对路径中反斜杠\必须写出/才正确
但是用我的绝对路径显示的是\
请问应该怎解决这个问题
UpdateData(TRUE);
if (fin.Open(m_pathin,CFile::modeRead|CFile::typeBinary)==FALSE)
{
AfxMessageBox(_T("open error"));
return;
}
CString a;
int a_len;
a = fin.GetFilePath();
a_len = a.ReverseFind('\.');
a = a.Left(a_len);
sprintf((char*)file_name, a + "_oo.bin");
//FILE* out_file = fopen((char*)file_name,"wb+");//错误
//FILE* out_file = fopen("D:/software_tools/OD/a.bin","wb+");//正确
FILE* out_file = fopen("D:\software_tools\OD\a.bin","wb+");//错误