C#相当于C`system()`标准库函数 [英] C# equivalent to C `system()` standard library function
问题描述
我开发了一个C ++程序,它通过以下代码使用一个.exe文件:
I developed a C++ program which utilises an .exe file through the following code:
system (TestApplication input.txt > output.txt )
TestApplication是这里的exe。 input.txt
是同一项目目录中的文件,output.txt通过程序在同一目录中生成。
TestApplication is the exe here. input.txt
is the file in the same project directory, and output.txt is generated in the same directory through the program.
我需要类似于上面的C#Gui(WPF)应用程序。
I have to something similar to above in C# Gui (WPF) application. What's the substitute class for `system' in C# and how do we perform the same operation?
推荐答案
System.Diagnostics.Process
类表示操作系统中的进程,并允许您创建新进程。
请参见 http://msdn.microsoft。 com / en-us / library / system.diagnostics.process.standardoutput.aspx ,了解您尝试执行的操作示例。
System.Diagnostics.Process
class represents the process in OS, and allows you to create new processes.
See http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardoutput.aspx for an example of what you're trying to do.
这篇关于C#相当于C`system()`标准库函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!