璐's profile石在帅的小璐PhotosBlogListsMore ![]() | Help |
|
July 20 NB的人儿啊困扰了我一个周末的问题,终于在网上找到了答案,牛人儿啊,zz:
在VS2005,2008下如何将LPCTSTR转换为const char *?
其实也就是如何将const wchar_t * 转换为 const char *。主要是在上篇那个判断文件访问的函数_access中传入的是const char所以报错,错误就是“不能将参数 1 从“LPCTSTR”转换为“const char *” ”
方法是: char str[1024]; 注意此处是wsprintfA而不是wsprintf,我在msdn中没找到wsprintfA。还有就是%S中的S是大写的。表示LPSTR。%s表示LPWSTR。 TrackbacksThe trackback URL for this entry is: http://superlulululu.spaces.live.com/blog/cns!9FA35ECFBD5AF4F!745.trak Weblogs that reference this entry
|
|
|