fopen 非 ASCII 字符错误
我无法在名称中包含某些字符的文件上使用 fopen(例如:ş、ç、ı) 我如何在这些文件上使用 fopen ? 我正在使用 vc++ 6 (我必须)和 c 语言。 当我尝试使用 _wfopen 时,它永远不会打开任何文件。
i cannot use fopen on files includes in their name some characters (example : ş, ç, ı)
how can i use fopen on these files ?
i'm using vc++ 6 (i have to) and c language.
when i was trying to use _wfopen it's never open any file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将路径名转换为 UTF-16(可能使用
MultiByteToWideChar
)并使用GetShortPathNameW
获取可以传递给fopen
的路径。Convert your pathname to UTF-16 (probably using
MultiByteToWideChar
) and useGetShortPathNameW
to get a path you can pass tofopen
.确保您有 wchar_t (它是编译器设置),并确保您向 _wfopen 传递的是 wchar_t * 而不是 char *。
Make sure that you have wchar_t (it's a compiler setting) and make sure you're passing in a wchar_t * and not a char * to _wfopen.