我正在为应用程序进行扩展。我的扩展程序使用 SolFS我想用它将所有文件流量重定向到 SolFS。为了实现这一点,我需要一些帮助,因为 SolFS 没有所有需要的功能的等价物(确切地说是 3 个)
这是我要“转换”的代码:http://pastebin.com/REh5MqSa
这是 SolFS 的 list :
//stuff I need which SolFS has
x remove
x fopen
x fclose
x fwrite
x fread
x access
x fgetpos
x fsetpos
这些我可以轻松地自己创建:
//stuff I can easily make
fgetc//I can easily make this one, Read with length onecand add one position to the seek, right?
fputc//Also easily done, write with seek, 1 char
对于这些,我需要你的帮助:
//stuff solFS doesn't have and I need help with
ungetc//how would i create an equivalent in for use with SolFS?
lseek//how would I create an lseek?
fileno//how? for use with lseek
我如何使用 SolFS 提供的函数创建 ungetc、lseek 和 fileno(fileno 与 lseek 一起使用)等价物?
最佳答案
我认为最好在 Eldos 网站上的论坛或 HelpDesk 上提问。
为了实现 ungetc,你必须分配一个小缓冲区,将字符放在 ungetc 函数中,并在 fgetc 函数中检查缓冲区。
lseek 函数可以通过 SolFSStream.Seek 方法实现,所以我认为您不需要实现 fileno 函数。
关于c++ - SolFS 中这些函数的等价物?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11714971/