Simple Virtual Filesystem in C/C++

前端 未结 6 1899
一个人的身影
一个人的身影 2020-12-31 15:02

I would like to implement a very simple Virtual Filesystem (VFS) which supports some basic file system operation like fwrite, fopen, fput, etc. The VFS is an abstraction lay

6条回答
  •  旧时难觅i
    2020-12-31 15:39

    Actually implemented this, so from experience here:

    The first thing to do is use classes. There is no fopen() equivalent. If there are flags, they're going to be an enum. Filenames are wchar_t nowadays.

    The second thing to do is factor out the OS-dependent parts of your file class. They should be in separate methods. You move these to a seperate file. For every OS you have, there will be a different file implementing the same methods. When you link your app, you know the target architecture and you can pick the correct versions.

提交回复
热议问题