Hi!
I am running a C program and need to pause the program and change some
of the variables. Is there any function that checks if there is a
character in the Standard Input Buffer, else the program keeps on
running. Can someone please help me on that.
AN 10 5137 am********@yahoo.com (Amit Nath) wrote in
news:17**************************@posting.google.c om: Hi!
I am running a C program and need to pause the program and change some of the variables. Is there any function that checks if there is a character in the Standard Input Buffer, else the program keeps on running. Can someone please help me on that.
No, not like I think you want. You'll need to find some platform-specific
function supplied by your compiler to "poll" for an input char. Such
functions are off-topic here, e.g. kbhit() for MS-DOS.
--
- Mark ->
--
In <Xn********************************@130.133.1.4> "Mark A. Odell" <od*******@hotmail.com> writes: am********@yahoo.com (Amit Nath) wrote in news:17**************************@posting.google. com:
I am running a C program and need to pause the program and change some of the variables. Is there any function that checks if there is a character in the Standard Input Buffer, else the program keeps on running. Can someone please help me on that.
No, not like I think you want. You'll need to find some platform-specific function supplied by your compiler to "poll" for an input char. Such functions are off-topic here, e.g. kbhit() for MS-DOS.
Using a debugger is probably a better option in the first place, as it
doesn't require any changes in the program.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de Da*****@cern.ch (Dan Pop) wrote in news:cb**********@sunnews.cern.ch: I am running a C program and need to pause the program and change some of the variables. Is there any function that checks if there is a character in the Standard Input Buffer, else the program keeps on running. Can someone please help me on that.
No, not like I think you want. You'll need to find some platform-specific function supplied by your compiler to "poll" for an input char. Such functions are off-topic here, e.g. kbhit() for MS-DOS.
Using a debugger is probably a better option in the first place, as it doesn't require any changes in the program.
Agreed. I had thought maybe he wanted to change variables normally input
by a user, like using the up arrow key to increase an averaging window
size or something.
--
- Mark ->
--
"Mark A. Odell" <od*******@hotmail.com> wrote in message news:<Xn********************************@130.133.1 .4>... Da*****@cern.ch (Dan Pop) wrote in news:cb**********@sunnews.cern.ch:
I am running a C program and need to pause the program and change some of the variables. Is there any function that checks if there is a character in the Standard Input Buffer, else the program keeps on running. Can someone please help me on that.
No, not like I think you want. You'll need to find some platform-specific function supplied by your compiler to "poll" for an input char. Such functions are off-topic here, e.g. kbhit() for MS-DOS.
Using a debugger is probably a better option in the first place, as it doesn't require any changes in the program.
Agreed. I had thought maybe he wanted to change variables normally input by a user, like using the up arrow key to increase an averaging window size or something.
While I am running the program, I would like to change the value of a
certain variable, say 'int i', if a character, say ESC, is present in
the Standard Input. If the ESC character is present, the program would
ask the new value of 'int i', else, the program continues with the new
value of 'i'.
I am interfacing some Keithley instruments with CEC488 board and the
data acquisition process is fully automatic and goes on for 6-7 hours
without any user intervaention. As a further modification, I am trying
to change some of the variables in the program if the 'ESC' button is
pressed. I am using a bit older version of BC++ (v 3.0, 16-bit) and am
running the program from MS-DOS. am********@yahoo.com (Amit Nath) wrote in
news:17**************************@posting.google.c om: I am interfacing some Keithley instruments with CEC488 board and the data acquisition process is fully automatic and goes on for 6-7 hours without any user intervaention. As a further modification, I am trying to change some of the variables in the program if the 'ESC' button is pressed. I am using a bit older version of BC++ (v 3.0, 16-bit) and am running the program from MS-DOS.
You are in luck then, there is an entire hierarchy of Borland newsgroups
to ask this question in. They will be able to help you "catch" the ESC key
using Borland extension to the C language. See the borland.public.*
hierarchy.
--
- Mark ->
-- am********@yahoo.com (Amit Nath) writes:
[...] I am interfacing some Keithley instruments with CEC488 board and the data acquisition process is fully automatic and goes on for 6-7 hours without any user intervaention. As a further modification, I am trying to change some of the variables in the program if the 'ESC' button is pressed. I am using a bit older version of BC++ (v 3.0, 16-bit) and am running the program from MS-DOS.
There's no portable way to do what you want in standard C, which is
what we discuss here. There is probably a non-portable way to do it.
You might try asking in comp.os.msdos.programmer. (But first consult
your documentation and/or do a web search; search for "kbhit" is
likely to be useful.)
--
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.
Thanks everyboby for all your help. kbhit() is a real hit and works
fine. I used kbhit() as:
(1) while (!kbhit())
{
....
// Code here
....
}
getch(); // To clear the keyboard input buffer
(2) if (kbhit())
{
....
// Change program parameters
....
getch();
}
Thanks once again,
AN
Amit Nath wrote: Thanks everyboby for all your help. kbhit() is a real hit and works fine.
Anyone on comp.lang.c that suggested the nonstandard kbhit() did you a
real disservice. It is not part of the standard C language and may well
not be supplied with the next implementation of C you need to use.
Further, there are no defined semantics or syntax which hold between
various implementations of this function.
If, on the other hand, you received this off-topic information by
private e-mail, then, godamit, respond by private e-mail.
I used kbhit() as:
Who the f. cares?
In <40**************@earthlink.net> Martin Ambuhl <ma*****@earthlink.net> writes: Amit Nath wrote:
Thanks everyboby for all your help. kbhit() is a real hit and works fine. Anyone on comp.lang.c that suggested the nonstandard kbhit() did you a real disservice.
Helping someone getting the job done in a platform specific manner, when
*no* portable solution exists doesn't exactly qualify as a "real
disservice".
It is not part of the standard C language and may well not be supplied with the next implementation of C you need to use. Further, there are no defined semantics or syntax which hold between various implementations of this function.
Yet, it is the only way of getting the job done. Therefore, it is also
the best way of getting the job done.
If, on the other hand, you received this off-topic information by private e-mail, then, godamit, respond by private e-mail.
Agreed. I used kbhit() as:
Who the f. cares?
Other people, confronted with the same problem, on the same (or similar)
implementations.
Agreed, kbhit is best discussed in an MSDOS programming newsgroup, but
there is nothing intrinsically wrong with a kbhit-based solution, as long
as nothing more portable is available.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Martin Ambuhl <ma*****@earthlink.net> wrote in message news:<40**************@earthlink.net>... Amit Nath wrote:
Thanks everyboby for all your help. kbhit() is a real hit and works fine. Anyone on comp.lang.c that suggested the nonstandard kbhit() did you a real disservice. It is not part of the standard C language and may well not be supplied with the next implementation of C you need to use. Further, there are no defined semantics or syntax which hold between various implementations of this function.
Does the C standard mandate that the usage of anything outside of it
is a sin worthy of punishment? Besides, you could wrap kbhit(), hiding
it as an implementation detail - a detail I might add which is not
covered properly by the standard.
If, on the other hand, you received this off-topic information by private e-mail, then, godamit, respond by private e-mail.
If you make assumptions about other people's actions, then goddamnit,
take your belligerence elsewhere. I used kbhit() as:
Who the f. cares?
The people who use newsgroups with the hope of receiving answers instead
of intimidation. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Paminu |
last post by:
Is there something like system("PAUSE") for linux?
|
by: Wim |
last post by:
My GUI application starts a process (a console program) when the user
hits Play. I would like to add an option to pause that process. The
code I've added to detect if the user hit pause/unpause...
|
by: Marek |
last post by:
What can I do in order to avoid first exception pause?
I am sure everyone already experienced this behavior and there must be a
solution.
regards
|
by: allen |
last post by:
I'm having a problem in that the first time an exception is thrown in
my app, there is about a 2 second pause. After that first time,
subsequent exceptions go very quickly. This pause is really...
|
by: Dave |
last post by:
I have a program that I need the program to temporarly stop and wait for a
response from a piece of equipment. After a set period I want the program to
continue. Like below
--execute lline...
|
by: Jackie |
last post by:
I just want the programme to stop for a while.
Thanks.
|
by: FaroeIslander |
last post by:
Hello all.
I am currently working on a program in VB.NET where the user can run a
"hidden" DOS program and as the program is running the user can see how many
computations have been performed by...
|
by: CoderMarc |
last post by:
Hi,
I can not get the system pause to work in a simple program. Here is my program below:
// i/o example
#include <iostream>
using namespace std;
int main ()
|
by: Kapteyn's Star |
last post by:
Hello all,
I want a function to make the program pause for a few seconds but K&R
have not listed anything for this i even looked in index. can anyone
help? Thank you very much.
--...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |