我在bugreport\bugreport
char szFile[100];
GetModuleFileName(NULL,szFile,sizeof(szFile));//AfxGetInstanceHandle()
//szFile是 d:\bugreport\bugreport\src\debug\bugreport.exe
//
如何根据szFile路径拼成下列路径"D:\\bugReport\\bugReport\\xls\\bug.xls"?
我想:根据szFile中前面的d:\bugreport\bugreport +"\\xls\\bug.xls"
m_pView->printExcel("D:\\bugReport\\bugReport\\xls\\bug.xls");而且在VC++里用的是\\和\是不一样的?请问如何由szFile 拼成路径"D:\\bugReport\\bugReport\\xls\\bug.xls"? 用啥方法?
char szFile[100];
GetModuleFileName(NULL,szFile,sizeof(szFile));//AfxGetInstanceHandle()
//szFile是 d:\bugreport\bugreport\src\debug\bugreport.exe
//
如何根据szFile路径拼成下列路径"D:\\bugReport\\bugReport\\xls\\bug.xls"?
我想:根据szFile中前面的d:\bugreport\bugreport +"\\xls\\bug.xls"
m_pView->printExcel("D:\\bugReport\\bugReport\\xls\\bug.xls");而且在VC++里用的是\\和\是不一样的?请问如何由szFile 拼成路径"D:\\bugReport\\bugReport\\xls\\bug.xls"? 用啥方法?
解决方案 »
- BT问题,Windows Mobile上是否有C++的IDE?
- 关于ATL控件的属性页的问题!!
- 请看这个select语句什么错误?输出结果好奇怪!
- 那位大虾有<<MFC Internals>>的下载地址?谢谢指点
- 在对话框静态成员函数或者全局函数里面怎么得到对话框内的控件对象?
- 如何保存csdn上的页面???
- 串口操作WriteFile在win98下正常,win2000下出错,请帮忙up或提供线索!
- 一个新手的问题
- 用ADO连接SQL SERVER数据库的疑惑
- 关于OpenProcess问题
- 怎样将BYTE型数组Array[n]转换CString变量strtemp??
- 使用VC些http客户端程序的时候怎么样来保持在同一个Session中
char szFile[100]
CString strFile;
szFile ="d:\bugreport\bugreport\src\debug\bugreport.exe"
strFile.format("%s",szFile);
strFile = strFile.Mid(0,strFile.GetLength()-22)+ "\\xls\\bug.xls";
这样就可以构成了字符串。
有无啥巧妙的方法来解决这个问题?感谢感谢!
不是说了吗,你这样是不对的。要写成:
szFile ="d:\\bugreport\\bugreport\\src\\debug\\bugreport.exe"
要显示D:\\bugReport\\bugReport\\xls\\bug.xls"? ,要写成:
D:\\\\bugReport\\\\bugReport\\\\xls\\\\bug.xls"? .至于你要用+操作怎么生成,就是你的程序的问题了.