Re: Pass an EOF instead of pressing enter
- From: richard@xxxxxxxxxxxxxxx (Richard Tobin)
- Date: 31 Dec 2006 10:36:30 GMT
In article <1167539258.863874.14460@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Camellia <breakfastea@xxxxxxxxx> wrote:
I input "abcd" follows by an EOF(Ctrl + d) instead of pressing enter,
and the program prints "abcd" on the screen. And then I pass an EOF
signal the program ends.
My question is why doesn't the program end the first it encounters the
EOF after the "abcd"?
This is really a question about your operating system, not about C.
Unix behaves as you describe - the EOF key only sends EOF after a
newline or another EOF.
And also if I DO press enter after "abcd", do I pass the characters
'a', 'b', 'c', 'd', '\n' to the program?
Yes. This is the usual situation. Pressing EOF without a newline
first is a way of sending a line without a newline at the end.
-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
.
- References:
- Pass an EOF instead of pressing enter
- From: Camellia
- Pass an EOF instead of pressing enter
- Prev by Date: Re: c / c++ : is it end of era ?
- Next by Date: Re: hex and unsigned and signed decimal
- Previous by thread: Pass an EOF instead of pressing enter
- Next by thread: C99 Grammar Definition
- Index(es):
Relevant Pages
|