473,625 Members | 3,201 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Keyboard stroke for EOF ?

What would be the keyboard stroke for EOF?

while((c=getcha r())!=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 43967
Ico
on********@gmai l.com wrote:
What would be the keyboard stroke for EOF?

while((c=getcha r())!=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********@gma il.comwrote in message
news:11******** *************@m 73g2000cwd.goog legroups.com...
What would be the keyboard stroke for EOF?

while((c=getcha r())!=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********@gmai l.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=getch ar())!=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**********@s pamcop.netwrite s:
On 17 Jul 2006 23:48:16 -0700, in comp.lang.c , on********@gmai l.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=getc har())!=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_Keit h) 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
2757
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 the space occupied by the keys on the right, so the reach to the mouse is not so bad, but the way they chose to do it? Ah - I see. Since most of what we type will simply be deleted at some point, let's make sure the Delete key is big and easy...
6
2886
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
1475
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 overwritten the method ProcrssCmdKey to handling key board messages, to allo object drwaing to be moved ky the left, right keys The issue is that this works fine when my control is hosted within a Form, but when it's hosted with a MDI window, it...
0
1179
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 key-stroke event from the DTE???? ThanX Nadav.
0
1342
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 this purpose? A code snippet will really help. Thanks in advance Omkar
13
3185
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 IE browser is open. I learnt that SetWindowsHookEx must be used along with few others. But my doubt is how to call my application? Can i implement the keyboard hooks related methods in the same project as my application or should this be else...
4
1238
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
20763
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 character is now a shape, but it will not let me apply a stroke to the text. Any help would be much appreciated. Thanks, Greg
2
6827
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 "spacebar") from one PC on our network to another programatically. My scenario is this
0
8253
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8189
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8692
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8354
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4192
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.