首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

GetShortPathName出了一个很鬼异的有关问题!

2012-09-04 
GetShortPathName出了一个很鬼异的问题!!!!!!!csPath.Replace(\\,\\\\)lpLongPath csPath.GetBuffe

GetShortPathName出了一个很鬼异的问题!!!!!!!
csPath.Replace("\\","\\\\");
lpLongPath = csPath.GetBuffer(511);//
long length=GetShortPathName(lpLongPath,shortpath,sizeof(shortpath));
if (length == 0) pCWnd->MessageBox(TEXT("GetShortPathName"),NULL,MB_OK);
wsprintf(command,"play %s",shortpath);
mciSendString(command, NULL, 0, NULL);
这样不对,无法播放。但是写成下面就行,不知为何。

long length=GetShortPathName("C:\\Documents and Settings\\ttc\\桌面\\共享\\中学时代.mp3",shortpath,sizeof(shortpath));
if (length == 0) pCWnd->MessageBox(TEXT("GetShortPathName"),NULL,MB_OK);
wsprintf(command,"play %s",shortpath);
mciSendString(command, NULL, 0, NULL);
运行时显示方法一,得到短路径没有成功,而方法二成功了!

[解决办法]
csPath.Replace("\\","\\\\");蛮奇怪的
把一个斜杠换成两个,路径会不会就错了

热点排行