Make a file pointer read/write to an in-memory location

后端 未结 4 1757
无人共我
无人共我 2020-12-01 10:38

I can make a file pointer write to a file with fopen(). But can I make a file pointer that will make it so calling functions such as fputc or fprintf will write to a pointer

4条回答
  •  执笔经年
    2020-12-01 11:12

    With a memory mapped file. This is platform specific so you'll need to find the information about creating mem-mapped files on your target system(s). I believe the posix version is mmap. At any rate, searching for "memory mapped file" on google should turn up a bunch of help.

提交回复
热议问题