【发布时间】:2014-07-16 21:54:21
【问题描述】:
我正在尝试在 C# 中使用 system(string str) 命令进行 dos 操作。
namespace XYZ
{
internal class Program
{
[DllImport("msvcrt.dll")]
static extern int system(string str);
static void Main(string[] args)
{
string Command = Console.ReadLine();
system(Command);
/* Excutes command, then "PInvokeStackImbalance". */
}
}
}
我知道使用static extern int system(string str) 是一个糟糕的解决方案,但我尝试了其他不起作用的解决方案。
【问题讨论】: