, respectively. For example, given this program:
382
P a r t I :
T h e C # L a n g u a g e
class Test {
static void Main() {
Console.WriteLine("This is a test.");
}
}
executing the program like this
Test > log
will cause the line “This is a test.” to be written to a file called
log
. Input can be redirected in
the same way. The thing to remember when input is redirected is that you must make sure
that what you specify as an input source contains sufficient input to satisfy the demands of
the program. If it doesn’t, the program will hang.
The
Do'stlaringiz bilan baham: