gpt4 book ai didi

c++ - 以编程方式使用 UTF8 挂载 FAT32 文件系统

转载 作者:太空狗 更新时间:2023-10-29 11:47:32 27 4
gpt4 key购买 nike

如何使用“mount()”函数(来自“mount.h”,参见“man 2 mount”)以 UTF8 挂载的方式挂载 FAT/FAT32 设备?

这是我现在用来挂载它的相关代码:

mount_result = mount(device_node, device_mount_point, fstype, MS_NOATIME, "");

谢谢,尼古拉

最佳答案

来自manpage :

The data argument is interpreted by the different file systems. Typically it is a string of comma-separated options understood by this file system.

来自 mount(8) 的联机帮助页, "vfat 的挂载选项":

utf8 : UTF8 is the filesystem safe 8-bit encoding of Unicode that is used by the console. It can be be enabled for the filesystem with this option. If 'uni_xlate' gets set, UTF8 gets disabled.

因此,这应该会为您提供所需的行为:

mount_result = mount(device_node, device_mount_point, fstype, MS_NOATIME, "utf8");

关于c++ - 以编程方式使用 UTF8 挂载 FAT32 文件系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5634058/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com