开发者

Using the same files on different file systems

Supp开发者_运维问答ose you have a C++ program that generates data to be saved on disk. You save it on your Windows Vista file system. Can you use it directly on another OS with a different file system (for example Mac OSX)?


yes. if you can get it onto the other system, or have visibility from one to another.

The file system should not be changing file content.


The only potential problem that I think of is the different formats for end-of-line markers: \n under UNIX, \r\n under Windows. I am not sure what Mac OSX uses (as a Unix system it should use \n, but if I recall correctly, older Mac OSs used \r). Of course it is easy to write converters between the formats.


That depends. Binary data will appear the same on all mainstream operating systems (where a byte is 8 bits; this is not necessarily true of embedded systems).

Files written in text mode may not "work" on all platforms out of the box, due to newline conventions (Windows uses \r\n for a newline, Unix-like systems \n) and character encoding issues.


Sure you can, given that your Operating System has the drivers to read both filesystems.

The fopen or equivalent calls are completely abstracted such that you don't have to worry about where it comes from. Data will be read the same way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜