Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下代码: http: //privatepaste.com/8364a2a7b8/12345
但它只写“c”(假设转换为 LPBYTE 只留下一个字节)。
处理 GetModuleFileName 和注册表编辑的正确方法是什么?
strlen((char*)szPath2)+1
这很可能是您的问题所在。我敢打赌你的程序是在 UNICODE 模式下编译的。strlen仅适用于 ASCII 字符串。(您必须从 TCHAR 转换为 char 的事实是一个很大的暗示,表明有些事情是不对的。)
strlen
为了与 TCHAR 等的用法保持一致,您可能应该_tcslen改用。
_tcslen