Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > how to quit

Reply
Thread Tools

how to quit

 
 
mynameisthomasanderson@gmail.com
Guest
Posts: n/a
 
      03-28-2007
Hi,
I'm pretty new to programming and i need a bit help from you, the
experienced programmers.
Well the thing is I'm making a small program on C. I want that
whenever user presses the key combination of ctrl+F3, he exits from
the program. how could I code this thing?

 
Reply With Quote
 
 
 
 
Daniel Rudy
Guest
Posts: n/a
 
      03-28-2007
At about the time of 3/27/2007 9:29 PM, http://www.velocityreviews.com/forums/(E-Mail Removed)
stated the following:
> Hi,
> I'm pretty new to programming and i need a bit help from you, the
> experienced programmers.
> Well the thing is I'm making a small program on C. I want that
> whenever user presses the key combination of ctrl+F3, he exits from
> the program. how could I code this thing?
>


Well, to exit, you do exit(EXIT_SUCCESS) or exit(EXIT_FAILURE). As for
control key sequences, you will need to find out what characters are
generated when a user hits CTRL-F3, then have your program look for that
key sequence.


--
Daniel Rudy

Email address has been base64 encoded to reduce spam
Decode email address using b64decode or uudecode -m

Why geeks like computers: look chat date touch grep make unzip
strip view finger mount fcsk more fcsk yes spray umount sleep
 
Reply With Quote
 
 
 
 
CBFalconer
Guest
Posts: n/a
 
      03-28-2007
(E-Mail Removed) wrote:
>
> I'm pretty new to programming and i need a bit help from you, the
> experienced programmers. Well the thing is I'm making a small
> program on C. I want that whenever user presses the key combination
> of ctrl+F3, he exits from the program. how could I code this thing?


Probably easier to have him hit CTL-C. You will probably not have
to do anything.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>



--
Posted via a free Usenet account from http://www.teranews.com

 
Reply With Quote
 
user923005
Guest
Posts: n/a
 
      03-28-2007
On Mar 27, 9:29 pm, (E-Mail Removed) wrote:
> Hi,
> I'm pretty new to programming and i need a bit help from you, the
> experienced programmers.
> Well the thing is I'm making a small program on C. I want that
> whenever user presses the key combination of ctrl+F3, he exits from
> the program. how could I code this thing?


>From the C-FAQ:


19.5: How do I read the arrow keys? What about function keys?

A: Terminfo, some versions of termcap, and some versions of curses
have support for these non-ASCII keys. Typically, a special key
sends a multicharacter sequence (usually beginning with ESC,
'\033'); parsing these can be tricky. (curses will do the
parsing for you, if you call keypad() first.)

Under MS-DOS, if you receive a character with value 0 (*not*
'0'!) while reading the keyboard, it's a flag indicating that
the next character read will be a code indicating a special key.
See any DOS programming guide for lists of keyboard scan codes.
(Very briefly: the up, left, right, and down arrow keys are 72,
75, 77, and 80, and the function keys are 59 through 68.)

References: PCS Sec. 5.1.4 pp. 56-7.

 
Reply With Quote
 
SM Ryan
Guest
Posts: n/a
 
      03-28-2007
(E-Mail Removed) wrote:
# Hi,
# I'm pretty new to programming and i need a bit help from you, the
# experienced programmers.
# Well the thing is I'm making a small program on C. I want that
# whenever user presses the key combination of ctrl+F3, he exits from
# the program. how could I code this thing?

Whether you want to poll for keypress or arrange some kind of
interrupt handler, you'll need a system specific function. What you're
going to get from ANSI C by itself is to stop the program until
input is available and then check the input characters. So it's going
to depend on the operating system and/or the windowing system.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
I have no respect for people with no shopping agenda.
 
Reply With Quote
 
Thomas Dickey
Guest
Posts: n/a
 
      03-28-2007
user923005 <(E-Mail Removed)> wrote:
> On Mar 27, 9:29 pm, (E-Mail Removed) wrote:
>> Hi,
>> I'm pretty new to programming and i need a bit help from you, the
>> experienced programmers.
>> Well the thing is I'm making a small program on C. I want that
>> whenever user presses the key combination of ctrl+F3, he exits from
>> the program. how could I code this thing?


>>From the C-FAQ:


> 19.5: How do I read the arrow keys? What about function keys?


> A: Terminfo, some versions of termcap, and some versions of curses


oh. "some versions of termcap" is a little odd (can anyone point
to a version of termcap that does not?).

most versions of curses as well - but this isn't the first inaccuracy
we've seen in the FAQ.

regards.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
 
Reply With Quote
 
user923005
Guest
Posts: n/a
 
      03-28-2007
On Mar 28, 9:01 am, Thomas Dickey <(E-Mail Removed)> wrote:
> user923005 <(E-Mail Removed)> wrote:
> > On Mar 27, 9:29 pm, (E-Mail Removed) wrote:
> >> Hi,
> >> I'm pretty new to programming and i need a bit help from you, the
> >> experienced programmers.
> >> Well the thing is I'm making a small program on C. I want that
> >> whenever user presses the key combination of ctrl+F3, he exits from
> >> the program. how could I code this thing?
> >>From the C-FAQ:

> > 19.5: How do I read the arrow keys? What about function keys?
> > A: Terminfo, some versions of termcap, and some versions of curses

>
> oh. "some versions of termcap" is a little odd (can anyone point
> to a version of termcap that does not?).
>
> most versions of curses as well - but this isn't the first inaccuracy
> we've seen in the FAQ.


If you have proof that there are no exceptions, then send an email to
Steve and he will correct it, I imagine.
I guess that there is at least one exception in either case.
Of course, both statements are mathematically true, because 'some' is
a subset of 'all'.
In any case, it's a nit.

 
Reply With Quote
 
Thomas Dickey
Guest
Posts: n/a
 
      03-28-2007
user923005 <(E-Mail Removed)> wrote:

> If you have proof that there are no exceptions, then send an email to
> Steve and he will correct it, I imagine.


He said he would the last time I pointed out an error.
He didn't correct it.

> I guess that there is at least one exception in either case.
> Of course, both statements are mathematically true, because 'some' is
> a subset of 'all'.
> In any case, it's a nit.


hmm - no. It's incorrect, and (even given the old information that he
used), was never correct since the FAQ was written.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
 
Reply With Quote
 
Thomas Dickey
Guest
Posts: n/a
 
      03-28-2007
Thomas Dickey <(E-Mail Removed)> wrote:
> user923005 <(E-Mail Removed)> wrote:


>> If you have proof that there are no exceptions, then send an email to
>> Steve and he will correct it, I imagine.


btw, his copyright precludes any extensive discussion.

http://c-faq.com/copyright.html

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      03-28-2007
In article <(E-Mail Removed)>,
Thomas Dickey <(E-Mail Removed)> wrote:

>>> If you have proof that there are no exceptions, then send an email to
>>> Steve and he will correct it, I imagine.


>btw, his copyright precludes any extensive discussion.
>
> http://c-faq.com/copyright.html


How can copyright preclude discussion?

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
my extensions quit working when i upgraded to 1.5 Joe Firefox 3 01-06-2006 05:41 PM
firefox quit and wont work Vernon Firefox 10 10-11-2005 04:12 PM
newbie having trouble with control structures: loop till recieve string QUIT M. Duijkers Perl 2 12-12-2004 11:02 AM
Junk Controls Quit David C Kifer Firefox 0 11-17-2004 06:59 PM



Advertisments