If I have the following code:
namespace foo {
public class FooClass {
public static void Main (string[] argsRaw) {
Console.WriteLine(Console.In.ReadToEnd());
}
}
}
开发者_如何学GoAnd I run it, process will stop once the end of the stream is reached.
Output:
(Text of my input stream)
[1]+ Stopped bin/Debug/foo.exe
How do I get my program to behave more like grep, which does not stop after hitting EOF?
I figured it out.
You need to make sure that Main's return type is an int.
namespace foo {
public class FooClass {
public static int Main (string[] argsRaw) {
Console.WriteLine(Console.In.ReadToEnd());
return 0;
}
}
}
Works.
精彩评论