Linux g ++中MSVC ++ _wrename的等价物? [英] Equivalent of MSVC++ _wrename in linux g++?

查看:136
本文介绍了Linux g ++中MSVC ++ _wrename的等价物?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道在linux g ++中是否存在等价的MSVC _wrename ? (相当于使用 const wchar_t * 代替 const char * 作为unicode使用的参数类型的cstdio文件重命名函数)



感谢!

解决方案

关键是大多数文件系统其他比NTFS将它们的文件名存储在 byte 字符串中。通常没有明确的编码概念,但文件名必须是由零终止的非零字节的字符串。所以在所有这样的系统中,文件系统函数只需要 char * 参数来表示文件名,并且您必须自己决定如何处理编码问题(如果有的话) p>

Windows是特殊的,因为NTFS中的文件名是以16位为单位的以空字符结尾的字符串。这与Windows上的16位 wchar_t 类型以及各种 _w * 文件系统函数结合在一起。 / p>

Does anyone know if an equivalent of MSVC _wrename exist in linux g++ ? (equivalent of cstdio file rename function using const wchar_t* instead of const char* as parameter type for unicode use)

Thanks !

解决方案

The point is that most filesystems other than NTFS store their filenames in byte-strings. There is usually no explicit notion of encoding, but the filenames have to be strings of non-zero bytes terminated by a zero. So on all such systems, filesystem functions just take char* arguments for filenames, and you have to figure our yourself how to handle encoding issues (should there be any).

Windows is special because filenames in NTFS are null-terminated strings of 16-bit units. This goes hand-in-hand with the 16-bit wchar_t type on Windows and various _w* filesystem functions.

这篇关于Linux g ++中MSVC ++ _wrename的等价物?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆