How to map BYTE array as FILE * on Windows

前端 未结 1 712
难免孤独
难免孤独 2021-01-22 18:39

I found old, huge open source code which performs some computations on binary data stored in file on disk, output is also saved as binary file.

There is one root method

相关标签:
1条回答
  • 2021-01-22 19:15

    It seems that you need the functionality of fmemopen:

    http://man7.org/linux/man-pages/man3/fmemopen.3.html

    Which takes a memory region and returns a file descriptor. Unfortunately, this is a POSIX function that does not have an equivalent in Windows. Memory mapped files are probably not what you want, as they take an existing file and map it to a memory region, not the other way around as with fmemopen. The only options you have are to either use fmemopen with mingw on Windows (don't know if you can do this) or roll out your own versions of fopen, fwrite and so on.

    0 讨论(0)
提交回复
热议问题