473,513 Members | 2,561 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I reset EOF (ctrl-Z) after it has been typed on the keyboard and used.

2 New Member
I used ctrl-z to signal the sw to go and it reports faithfully (using cin.eof) that EOF has changed from 0 to 1. Now I want to reset EOF to 0 so I can use it again.
I thought of rewind but this is not file work.
Sep 4 '10 #1
3 3147
weaknessforcats
9,208 Recognized Expert Moderator Expert
I don't think you can reset EOF. What it means is "end of all input" so I don't think you can change your mind and say "Hold it! There's more input".

I suggest using a test other than EOF. Like maybe parsing the the input until the user enters "Done". Noe you can ask for more input and search for "Done" again.
Sep 4 '10 #2
Charles Pique
2 New Member
In the beginner's program that I had, enter followed ctrl-z.
Other beginner's programs used enter to signal that input was complete and they would go process. Then another line could be typed with enter and it would be processed in turn. That was a different command.
I am reading Deitel chapter 21 about commands like cin.get and cin.eof. The EOF is reset if the program is ended and restarted (all this in the old Turbo C version 3 on a 486). It does not appear that their demonstration program for cin.eof is very useful for keyboard input.
In any case the only specific task that I have to do is learn C.
I am very concerned about I/O because I want to write code one day to control and monitor peripherals and that has usually been tricky.
I try to find a way to undo anything that changes the machine state. That way I have complete control
Sep 5 '10 #3
weaknessforcats
9,208 Recognized Expert Moderator Expert
The EOF indeed is ctrl+z. However, you need to press enter to get the ctrl+z into the stdin stream.

The ctrl+z signals the end of all input.

With a real user, you can't control what is entered. All you can do is provide instructions that if the user enters certain data that your program will do certain things. Should the user fail to follow your insturctions and your program croaks, then what more is to be said?

So the Deitel example is probablty OK as long as ctrl+z is used as directed.
Sep 5 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
12157
by: Mike Maxwell | last post by:
<vent> I see there has been traffic over the years on this gripe, so just let me vent my frustration, and add another reason why 'exit' (or possibly exit() or quit() or halt() or some such) should...
4
1700
by: macuser55 | last post by:
Hello all, I would like to do a simple input scan from the command line, but only if the user has typed something... I have had a look at the select() method, but am still having trouble. ...
7
26516
by: jpierson | last post by:
Hi, I am tryin to create a keyboard hook that sends the keystroke ctrl + pause/break. I haven't used keyboard hooks before so I'm not too sure how to use them public int MyKeyboardProc(int...
24
9266
Mague
by: Mague | last post by:
Hey, Im a 13 yr old who needs help. I need a code which can detect if Ctrl R has been pressed. I cannot use e.key thingy because i have got text box on mi page so that doesnt work. I also need it...
331
14679
by: Xah Lee | last post by:
http://xahlee.org/emacs/modernization.html ] The Modernization of Emacs ---------------------------------------- THE PROBLEM Emacs is a great editor. It is perhaps the most powerful and...
2
1743
by: manusiatidakbiasa | last post by:
Hi, I am new in javascript, I am currently building a simple website, and I like to make a keyboard shortcut so when someone press ctrl-1, it will give keyboard focus to a textbox can...
7
3405
by: RADAR | last post by:
i use VC++ 6,0 and i have problems with getting keyboard system inputs and to use them to check to proceed or break the loop. for example if i want to proceed until Ctrl+z is written for input.What...
3
1878
by: farahnaz | last post by:
Hi, I really don't know where else to look. I am working on an ajax application and got it working up to a point by referring to numerous websites and learning javascript as I went along. I use a...
18
1977
by: slenish | last post by:
I imported some data from an excel spreadsheet to a table in Access. There is one field where they have two pieces of information typed into one column that i want broken in to two columns. Is it...
0
7259
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,...
0
7158
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
7535
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...
1
7098
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...
0
7523
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5085
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
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...
0
1592
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 ...

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.