在 Visual Studio 中使用重定向运算符的 C#

发布于 2024-10-02 13:21:54 字数 471 浏览 2 评论 0原文

我正在将 C 程序转换为 C# 并使用 MS Visual Studio 2005。在 C 程序中,参数传递为

CProg.exe DataFile < ParameterFile > OutPutFile

当我在 C 项目的项目设置中使用上述参数时,它工作正常。标准输入设备现在重定向到“ParameterFile”,标准输出设备重定向到“OutPutFile”。

但是当我将它与 C# 项目一起使用时,它不会重定向 StdIn 或 SdtOut 设备。在应用程序中(使用 Visual Studio 进行调试时),我将所有这些值作为参数获取(包括“<”和“>”)。

但是当我通过命令提示符运行 C# 应用程序时,它工作正常(与 C 应用程序相同)。

似乎 MS Visual Studio 2005 在调试应用程序时不理解重定向运算符。

或者我缺少一些设置? 请建议。

I am converting a C program to C# and using MS Visual Studio 2005. In C program the arguments are passed as

CProg.exe DataFile < ParameterFile > OutPutFile

When I use above parameters in my project settings of C project, it works fine. Standard Input device is now redirected to "ParameterFile" and standard output device to "OutPutFile".

But when I use it with C# project, it does not redirect StdIn or SdtOut devices. In the application (while debugging it with Visual studio) I get all these values as arguments (including "<" and ">").

But when I run the C# application through command prompt, it works fine (same as C application).

It seems that MS Visual Studio 2005 does not understand redirection operators while debugging the application.

Or am I missing some settings??
Please suggest.

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

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

发布评论

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

评论(1

悲念泪 2024-10-09 13:21:54

我不确定 VS 2005 支持它们。如果这只发生在调试模式下,您是否考虑过对输出重定向进行硬编码?无需写入控制台,只需写入文件流,读取操作也是如此。即使您有大量 IO,更改也不应该那么困难。然后当你有工作程序时,将其改回来。

I'm not sure VS 2005 supports them. If this only happens in debug mode, have you considered hard coding the output redirection? Instead of writing to the console, just write to a file stream and same for read operations. It shouldn't be that hard to change, even if you have tons or IO. Then when you have the working program change it back.

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