可以编译和运行C程序的VB.NET应用程序

发布于 2024-08-28 04:21:26 字数 342 浏览 4 评论 0原文

这些天我正在开发一个 VB.NET 应用程序,它可以用来编辑、编译和运行 C 程序。有人可以告诉我如何从 VB 程序中调用 cl.exe 进程,以及如何在控制台窗口本身中运行该程序。

目前我只准备好了编辑器。这样,我们就可以输入一个程序并以“.c”扩展名保存它。现在我的表单上有 2 个按钮 - “编译”和“运行”。当用户单击“编译”按钮时,程序应传递给 cl.exe 进程,并且错误应显示在另一个文本框或 DOS 中(本身黑屏)。当用户单击“运行”按钮时,刚刚创建的“.exe”文件应该被执行。

有没有办法将一些文件与我的程序一起附加,以便计算机中没有安装“C”的人也可以使用我的应用程序编辑、编译和运行 C 程序?

These days I'm working on a VB.NET application which can be used to edit, compile and run C programs. Can someone tell me how I can call a cl.exe process from within my VB program and also that how do I run the program in the console widow itself.

Presently I have only the editor ready. With that one can type in a program and save it with a ".c" extension. Now there are 2 buttons on my form - "Compile" and "Run". When the user clicks on the "Compile" button, the program should be passed to the cl.exe process and the errors should be displayed in another textbox or the DOS(black screen itself). And when the user clicks on the "Run" button, the ".exe" file which just got created should get executed.

Is there any way to attach some files along with my program so that the people who do not have "C" installed in their computers can also edit, compile and run C programs using my application?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

魄砕の薆 2024-09-04 04:21:27

要捕获编译器或编译和链接程序的输出,请使用 System.Diagnostics.Process.StandardOutput 属性来检索 System.IO.StreamReader 实例。

To capture the output of the compiler or the compiled and linked program, use the System.Diagnostics.Process.StandardOutput property to retrieve a System.IO.StreamReader instance.

乄_柒ぐ汐 2024-09-04 04:21:26

您可以使用 System.Diagnostics.Process 类来做到这一点。

您可以使用 Start 方法启动任何可执行文件。您可以传递参数等,就像从命令行一样。

添加

您可以使用Process.StartInfo.RedirectStandardOutput 属性

重定向错误、输入等也有类似的方法。

You can use the System.Diagnostics.Process class to do this.

You can launch any executable using the Start method. You an pass arguments, etc, just like you would from the command line.

Added

You can redirect the output of the program using the Process.StartInfo.RedirectStandardOutput property.

There are similar methods for redirecting errors, input, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文