简体   繁体   中英

Create a pipe file in windows/.net

I am using an older program that generates it's output into a file. I can specify on the command line the file to use, but it must go to a file (no option to send to stdout ).

I would like to stream that output as it is generated (not wait until the file is finished). In *nix, I would create a named pipe, and use that "file" as the output.

Can this (or something similar) be done in Windows? Can it be done in pure C#, or only c/c++/pInvoke? Is there some library that can do this cross platform?

From your .Net application, you can spawn the legacy application as a Process , for which you can define, among other things, its standard output stream . You can use a file stream or any other kind of stream to redirect the process's output.

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