有麻烦,提取系统路径出错~~~~~:( windows API要加::char dir[512]; UINT dirlen; ::GetSystemDirectory[dir,MAX_PATH]; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 code_man说的不太对……原因是:GetSystemDirectory是一个函数,而C/C++函数调用应该使用(),而不是[]。所以,这样就对了:char dir[512]; UINT dirlen; GetSystemDirectory(dir,MAX_PATH);^_^ :(出现这个错误:error C2664: 'GetSystemDirectoryW' : cannot convert parameter 1 from 'char [512]' to 'unsigned short *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castError executing cl.exe. 这是因为你打开了Unicode,关了就可以了。如果确是有必要使用Unicode的话,就不应该使用char,应该使用wchar_t(这也是标准C++的呦!) VC中既可以浏览文件夹又可以浏览文件 关于二维数组求助 cpen画直线的小问题 可以推荐1-2本关于xml入门的书吗 求助:怎样更新主框架窗口 在VC中如何获取计算机系统时间啊??? 怎样屏蔽VC建立的窗口Alt+F4就能关闭 数据库怎么存储图片(用二进制) 一道很难的编译原理题目,也很变态 为什么想在这里找个项目做做都找不到?给我项目做吧,我给高分! 小问题,取到系统目录后,怎么把他代入程序呢? 密码操作问题!有胆量者进来!
而C/C++函数调用应该使用(),而不是[]。
所以,这样就对了:
char dir[512];
UINT dirlen;
GetSystemDirectory(dir,MAX_PATH);^_^
出现这个错误:
error C2664: 'GetSystemDirectoryW' : cannot convert parameter 1 from 'char [512]' to 'unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
关了就可以了。如果确是有必要使用Unicode的话,
就不应该使用char,
应该使用wchar_t(这也是标准C++的呦!)