I think getch() is the most primitive input function of C, on which
getchar(),etc. are based. What may be happening is that getchar() uses getch() to take input, and keeps buffering it till getch() returns 26 (ascii for ctrl+z, which indicates the end of input in Windows) is encountered. It now senses that its the end of input and returns EOF.
daudiam
-6
Junior Poster
Recommended Answers
Jump to Post>I think getch() is the most primitive input function
>of C, on which getchar(),etc. are based.
Such an implementation is certainly possible, but I haven't heard of one in the wild yet. Further, even if an implementation did exist that used getch as a primitive base for stdio, your statement …
Jump to Postgetch() returns 26 (ascii for ctrl+z, which indicates the end of input in Windows)
That's a very usual misconception. First of all, ctrl+z is only significant for text mode streams. Second, for text mode streams, ctrl+z is handled by the driver. It is the driver who encounters ctrl+z, and in …
All 7 Replies
Narue
5,707
Bad Cop
Team Colleague
nezachem
616
Practically a Posting Shark
daudiam
-6
Junior Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
daudiam
-6
Junior Poster
Salem
5,138
Posting Sage
nezachem
616
Practically a Posting Shark
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.