Си диез / Говнокод #11831 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
while (true) {
    Console.WriteLine(answer);
    answer = process.StandardOutput.ReadLine();
}

Человеку нужно просто считывать команды (строки) из консоли. Делает через жопу.

Запостил: Fai Fai, (Updated )

Комментарии (4) RSS

  • Блин жопу то не запостил.
    var process = new Process
    {
    StartInfo = new ProcessStartInfo("cmd.exe")
    {
    RedirectStandardOutput = true,
    RedirectStandardInput = true,
    UseShellExecute = false,
    }
    };
    process.Start();
    //while (process.StandardOutput.ReadLine() != "") ;
    string com = Console.ReadLine();
    while (com != "exit") {
    process.StandardInput.WriteLine(com);
    string answer = process.StandardOutput.ReadLine();
    
    while (true/*answer != ""*/) {
    Console.WriteLine(answer);
    answer = process.StandardOutput.ReadLine();
    }
    
    com = Console.ReadLine();
    }
    process.StandardInput.WriteLine("exit");
    process.WaitForExit();
    string output = process.StandardOutput.ReadToEnd();
    Console.WriteLine(output);
    Console.ReadLine();
    Ответить

Добавить комментарий

Из-за тебя ушел bormand, guest!

    А не использовать ли нам bbcode?


    8