SolFS中这些功能的等价物?

时间:2012-07-30 03:09:07

标签: c++ c vfs ungetc

我正在为应用程序进行扩展。我的扩展程序使用SolFS,我想用它将所有文件流量重定向到SolFS。为了实现这一点,我需要一些帮助,因为SolFS没有所有需要的功能的等价物(确切地说是3)

这是我将“转换”的代码:http://pastebin.com/REh5MqSa

以下是SolFS所拥有的资料清单:

//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)等价物?

1 个答案:

答案 0 :(得分:2)

我认为最好在论坛或HelpDesk上的Eldos网站上提问。

为了实现ungetc,你必须在ungetc函数中分配一个小缓冲区,然后在fgetc函数中检查缓冲区。

你可以通过SolFSStream.Seek方法实现lseek函数,所以我认为你不需要强制执行fileno函数。

相关问题