473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Keyboard stroke for EOF ?

What would be the keyboard stroke for EOF?

while((c=getchar())!=EOF) printf("%c",c);

what would cause the program to come out of the while loop?I am using
the compiler that comes with SDK.

Thanks
C Novice.

Jul 18 '06 #1
4 43912
Ico
on********@gmail.com wrote:
What would be the keyboard stroke for EOF?

while((c=getchar())!=EOF) printf("%c",c);

what would cause the program to come out of the while loop?I am using
the compiler that comes with SDK.
The EOF code is not really generated by a key; usually it is your
operating system that handles the key, and stops reading the file. This
generates the end-of-file, which is handled by your if.

You say nothing about the OS or platform you are running on, but you
could try Ctrl-D or Ctrl-Z

--
:wq
^X^Cy^K^X^C^C^C^C
Jul 18 '06 #2

<on********@gmail.comwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
What would be the keyboard stroke for EOF?

while((c=getchar())!=EOF) printf("%c",c);

what would cause the program to come out of the while loop?I am using
the compiler that comes with SDK.
It varies by environment. Try ctrl-Z (Windows/DOS), ctrl-D (Unices). If
those don't work, try one of these ctrl-T, ctrl-Y, ctrl-V, ctrl-M (I don't
know if they actually do anything though...).

Sorry if I sound bitter, but...

Seriously, how long does it take to test all keystrokes? (Not long, I did
so many years ago...)

How hard is it to go to www.wikipedia.org and enter EOF?
http://en.wikipedia.org/wiki/End-of-file

How hard is it to go to Google Groups Advanced Search, enter comp.lang.c and
eof?
http://groups.google.com/advanced_search?hl=en

Rod Pemberton

Jul 18 '06 #3
On 17 Jul 2006 23:48:16 -0700, in comp.lang.c , on********@gmail.com
wrote:
>What would be the keyboard stroke for EOF?
EOF isn't a character, its a condition. How you generate it depends on
your operating system, but control-D and control-Z are popular
selections.
>while((c=getchar())!=EOF) printf("%c",c);

what would cause the program to come out of the while loop?
Generating an EOF condition!
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jul 18 '06 #4
Mark McIntyre <ma**********@spamcop.netwrites:
On 17 Jul 2006 23:48:16 -0700, in comp.lang.c , on********@gmail.com
wrote:
>>What would be the keyboard stroke for EOF?

EOF isn't a character, its a condition. How you generate it depends on
your operating system, but control-D and control-Z are popular
selections.
>>while((c=getchar())!=EOF) printf("%c",c);

what would cause the program to come out of the while loop?

Generating an EOF condition!
To be painfully precise, end-of-file is a condition; EOF is a macro,
expanding to a negative integer constant (typically -1), whose value
is returned by certain functions when an end-of-file condition (or an
error condition) is encountered.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jul 18 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Steve Jorgensen | last post by:
Well, it seems that Microsoft, or whatever powers that be have decided it's time for us to have yet another standard keyboard layout change. I think I see that the point of this one was to reduce...
6
by: DS | last post by:
Is there a key stroke that you can use to copy the previous record into the new record? This is in Datasheet view. Thanks DS
0
by: Fred Heida | last post by:
Hi, I have a control derived from ContainerControl, the class does not contain any other windows forms control, it's sole purpose it to act like drawing surface for my drawing tool... If have...
0
by: Nadav | last post by:
Hi, I am writing a VS.NET AddIn, I wish to get key-stroke events from the IDE e.g. F5, CTRL+F2, ... I didn't find any method/event that provide this kind of functionality... How can I get...
0
by: Omkar Mate | last post by:
I am developing a Win32 console application (VS.NET, VC++) in which I have to demonstrate the API - "WaitForSingleObject". I have to wait on some key stroke "event". Which event should I use for...
13
by: Hema | last post by:
hello all, I am working on a project related to Internet Explorer. I want my application to be invoked by a keypress( single key stroke or a combination). But this must get invoked only when the...
4
by: giannis | last post by:
How can i bind a keyboard stroke to a form for a specific keyboard key and write code for this event ?
7
gregerly
by: gregerly | last post by:
Hello, I'm just starting to play around with Flash, and I'm wondering how I can apply a stroke color to fonts in flash cs3? I've tried breaking the text apart, then breaking apart again (so each...
2
by: =?Utf-8?B?bWFib25k?= | last post by:
Hi don't know if this is the best forum or if my request is possible...hope someone out there can suggest a pointer for me. I want to to be able to send a keyboard keystroke (specifically the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.