简体   繁体   中英

Windows equivalent of Linux fifo

I use a function from a library that take a file name as parameter. In my application I receive the data from the network, so I can't feed the library with the downloaded data directly because I can't write it on the disk. To solve the problem I'm using Linux fifo (created with mkfifo() ) and I give the fifo name to the library.

Now I have to port the code to Windows and I'm looking for an equivalent of Linux fifo mechanism. I already tried Windows Named Pipe but these pipes can't be opened like regular files with standard library functions like fopen() (unless I'm missing something).

Do you know a Windows mechanism to read data from memory as a file ?

Named pipes are in fact what you want. If you want to use them with the C runtime, fread , fwrite and fclose use the _popen or _wpopen function to create the pipe. On Windows, pipes are part of a separate namespace from file names. There is simply nothing you can pass to fopen that is equivalent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM