What IS THIS

S

Seven Kast USA

hi
if we running a c program , that if u press ctrl +d or +z or +c ,
then program will closed.. what behind processing .........
by
KAST
 
A

Andrea Laforgia

Lawrence said:
You have posted a whole bunch of rather general and vague questions, most
of which are not about standard C specifically hence are off topic for
this newsgroup.

....and usually makes me think of those people as trolls ;-)
 
L

Lawrence Kirby

hi
if we running a c program , that if u press ctrl +d or +z or +c ,
then program will closed.. what behind processing .........
by
KAST

You have posted a whole bunch of rather general and vague questions, most
of which are not about standard C specifically hence are off topic for
this newsgroup.

For example C doesn't define any special meaning for contyrol sequences
auch as ctrl-d etc. How these are interpreted if yuo type them in on a
keyboard is down to your OS/command line evironment, they will probably
affect programs written in a language other than C in a similar way. So
you need to 1) establish what OS/environment you are using and 2) ask in a
newsgroup appropriate to that, by try checking the documentation first.

Lawrence
 
K

Kristofer

Seven said:
hi
if we running a c program , that if u press ctrl +d or +z or +c ,
then program will closed.. what behind processing .........
by
KAST

That's not for this newsgroup, but CTRL-C is sending a break to the
program, which usually makes the operating system stop it (you can set
up signals to catch this, but again, thats not for this group). CTRL-D
/ CTRL-Z are EOF markers, depending on your operating system.. Yet
again, not for this group. Assuming you're using UNIX, check
comp.unix.programmer.
 
S

Simon Biber

Kristofer said:
That's not for this newsgroup, but CTRL-C is sending a break to the
program, which usually makes the operating system stop it (you can set
up signals to catch this, but again, thats not for this group). CTRL-D
/ CTRL-Z are EOF markers, depending on your operating system.. Yet
again, not for this group. Assuming you're using UNIX, check
comp.unix.programmer.

<OT>If the OP is using Unix, Ctrl-Z is likely not actually closing the
program but just pausing it. After pressing Ctrl-Z in a running program,
try the command "fg" to return it to the foreground, or "bg" to make it
continue running in the background.</OT>
 
W

Walter Roberson

That's not for this newsgroup, but CTRL-C is sending a break to the
program, which usually makes the operating system stop it (you can set
up signals to catch this, but again, thats not for this group).

[OT]

That's right, but for Unix in another way it isn't.

In Unix, each input stream may be interpreted by a "line discipline"
layer, which interprets the input and may perform special processing.
In Ye Olde Dayes, only interactive serial lines had line disciplines;
after several years, "pseudo-terminals" were added that could have line
disciplines too. In Unix systems that handle inputs in terms of
"Streams" [note the capital S], -any- input stream can have a line
discipline module added to it (possibly leading to unintended
results...)

A line discipline layer examines each character as it comes in, and
does whatever processing it's configuration tables tells it to. That
processing might include echoing the character as well as buffering it,
or might include deleting a character from the input buffer, or
suspending the current job, or a number of other things.

When a line discipline layer reads the character that is currently
configured as the interrupt character (control-C and DEL are the two
most common settings for this, but it is configurable), then -if it is
in the appropriate processing context [*]-, the layer would use kill()
or raise() other appropriate call in order to send a signal to the
program that is being controlled. The way that program reacts will
depend upon what signal handler is in effect for the appropriate
signal.

The fundamental difference between this description and the previous is
in the phrase "sending a break to the program". A "break" would be an
inband marker, but udp has no mechanism for indicating breaks and the
tcp mechanism that could convey breaks is optional and not implemented
particularily commonly, and the appropriate detection mechanism for
that tcp facility are built into programs even less commonly. A signal,
though, is an out-of-band operation undertaken by the operating system
(and which can often only be carried to local processes.)


[*] "In the right processing context" -- there can be several contexts
in which the interrupt character does not mean "interrupt". For
example, it might have been proceeded by a quote-next-character
indicator, or the input layer might be in an editting mode in which the
interrupt character might mean something else completely such as
"delete the previous character" or "copy the saved input buffer".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top