简体   繁体   English

在windows / .net中创建管道文件

[英]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 ). 我可以在命令行上指定要使用的文件,但它必须转到文件(没有选项发送到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. 在* nix中,我将创建一个命名管道,并使用该“文件”作为输出。

Can this (or something similar) be done in Windows? 这个(或类似的东西)可以在Windows中完成吗? Can it be done in pure C#, or only c/c++/pInvoke? 它可以在纯C#中完成,还是仅在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 . 从.Net应用程序中,您可以将遗留应用程序作为Process生成,您可以为其定义标准输出流 You can use a file stream or any other kind of stream to redirect the process's output. 您可以使用文件流或任何其他类型的流来重定向进程的输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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