Discussion:
Input specs
(too old to reply)
Ian MacDonald
2003-11-27 01:18:16 UTC
Permalink
alright, this is confusing me a bit..

we're supposed to terminate on ^D.. i get that.
but will there always be a \n before the ^D?

if not, do we throw out the characters on that line, or do we still deal
with them?

it says it's safe to assume that the program doesn't see input until a \n,
so i'm tempted to believe we just ignore characters on the same line as a
^D..

e.
Caroline Kierstead
2003-11-27 14:37:18 UTC
Permalink
Post by Ian MacDonald
alright, this is confusing me a bit..
we're supposed to terminate on ^D.. i get that.
but will there always be a \n before the ^D?
If you're typing at the keyboard, there has to be a '\n' since
Ctrl-D has to be the first character on its own line; however,
if you're redirecting input from a file, it shouldn't matter,
though many editors do force a '\n' on the last line.

Either way, all characters should be dealt with.
--
--
Caroline Kierstead, Instructional Support Coordinator
University of Waterloo, DC3138 (519) 888-4567 x6226
Loading...