writing cgi programs in c: the system() call.

J

James Kuyper

jleslie48 said:
]
Standard C has no concept of "background tasks", which is exactly why
this isn't the right place for your question.

Standard C is completely based on background tasks. the "system",
"exec", "fork", family of library functions are some of the most
fundamental of the language.

Tasks run by calling system() don't have to run in the background, and
do not do so on many systems.

The exec() and fork() family of functions are not part of the C standard
library. You won't find any mention of them anywhere in the C standard.
They are UNIX functions. You'll find functions with similar if not
identical names, and similar if not identical capabilities, in many
other operating systems. But they are not part of C itself.
 
L

lawrence.jones

jleslie48 said:
thanks again for all answers. I will try the "start notepad" on
wednesday, I was away from my desk today. If my cgi.exe program
completes, that at least solves half my problem and gets me closer to
a solution.

No, it doesn't. It leads you further down the completely wrong path.

What you still haven't grasped is that Apache is a *server*, it doesn't
have a desktop to display things on, so there's no way you're ever going
to get a CGI script running in that server to display something on a
desktop. What you need to do is have your CGI script tell the
*browser*, which *does* have a desktop, to run notepad rather than
trying to do it itself. That can almost certainly be done, but it
requires web programming (java script, active x, or what have you), not
C programming.
 
J

jleslie48

jleslie48 said:
]
Standard C has no concept of "background tasks", which is exactly why
this isn't the right place for your question.
Standard C is completely based on background tasks. the "system",
"exec", "fork", family of library functions are some of the most
fundamental of the language.

Tasks run by calling system() don't have to run in the background, and
do not do so on many systems.

The exec() and fork() family of functions are not part of the C standard
library. You won't find any mention of them anywhere in the C standard.
They are UNIX functions. You'll find functions with similar if not
identical names, and similar if not identical capabilities, in many
other operating systems. But they are not part of C itself.

yes, I see my mistake. I'm confusing my C programming language book
and my Unix programming environment book.

Anyway, I have the solution to the issue to put closure to my original
question.

The apache-server has a switch to control just this thing.

In the system tray, right-click on the apache icon, and the "open
services" button. Right click on the "apache2" service, tab to "logon"
and there it is, A checkbox for "allow service to interact with
desktop". I stopped and restarted the service, and all is working
now.
 
K

Kenny McCormack

jleslie48 said:
In the system tray, right-click on the apache icon, and the "open
services" button. Right click on the "apache2" service, tab to "logon"
and there it is, A checkbox for "allow service to interact with
desktop". I stopped and restarted the service, and all is working
now.

To the OP: Well done!

To Flashy: See! I was right all along. I accept your apology.
 
F

Flash Gordon

jleslie48 wrote, On 26/09/08 17:33:

The apache-server has a switch to control just this thing.

<snip>

Perhaps next time you will believe people when they tell you that it is
not a C problem and that you need to ask else where. Just think how much
faster you would have had the solution if you had asked around on Apache
and/or web development and/or Windows type groups when you were told to.
It would have saved you from trying a solution guaranteed to not solve
your problem.
 
F

Flash Gordon

Kenny McCormack wrote, On 26/09/08 18:14:
To the OP: Well done!

To Flashy: See! I was right all along. I accept your apology.

Bollocks. Using start did not solve the OPs problem, as started by the
OP above by the OP. Asking in an appropriate place would have given him
an answer far faster. It would probably have also told him about the
massive security hole he has just opened on the PCs.
 
K

Kenny McCormack

Flash Gordon said:
Bollocks. Using start did not solve the OPs problem, as started by the
OP above by the OP.

You're so cute when you're mad. And, yes, I mean that in both senses of
the word 'mad'.
Asking in an appropriate place would have given him
an answer far faster. It would probably have also told him about the
massive security hole he has just opened on the PCs.

That may well be. Still, the fact remains that the OP had two distinct
problems:
1) His stated problem - that system() was "hanging". That
problem I addressed and answered, 100% correctly and
appropriately.
2) His implied problem - that the Notepad window wasn't showing
up onscreen. This was due to Apache being misconfigured
(from his POV, if not from yours). That issue, too, was, in
due course, resolved.
 
K

Kenny McCormack

No, it doesn't. It leads you further down the completely wrong path.

I assume you posted before reading the rest of the thread. The rest of
the thread shows that the OP did, in fact, resolve his issue, by fixing
the Apache configuration.
 
K

Keith Thompson

jleslie48 said:
]
Standard C has no concept of "background tasks", which is exactly why
this isn't the right place for your question.

I wrote the above. You deleted the attribution line. Don't do that.
Standard C is completely based on background tasks. the "system",
"exec", "fork", family of library functions are some of the most
fundamental of the language. K&R's first edition introduced them, the
entire UNIX operating system is built with them, and the current K&R
book continues with all of the constructs of the Parent-Child
paradigm.

The >system("start notepad");< command does free up my cgi to
respond, but alas as predicted, I still don't have a desktop
addressable notepad session.

As others have already told you, most of the above is *not*
standard C.

You were advised multiple times to ask your question elsewhere,
particularly comp.os.ms-windows.programmer.win32. A Google Groups
search indicates that you never did. Why did you come here for
advice if you were unwilling to follow it?

You've apparently found a "solution" to your problem, but as somebody
else has mentioned, you may have just opened a huge security hole
in your system. I don't know whether that's true or not, but it's
certainly plausible.

*Please* post to a more appropriate newsgroup where you can get
good advice.
 
J

jleslie48

Perhaps next time you will believe people when they tell you that it is
not a C problem and that you need to ask else where. Just think how much
faster you would have had the solution if you had asked around on Apache
and/or web development and/or Windows type groups when you were told to.
It would have saved you from trying a solution guaranteed to not solve
your problem.
--
Flash Gordon
If spamming me sent it to (e-mail address removed)
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me athttp://clc-wiki.net/

and perhaps you will realize that I did go elsewhere when it became
the consensus that that is where my problem lay. Something I did not
realize until I came here, but then again that is why I did come here,
despite arrogant elitists, who think analyzing and questioning my
reasons for doing something is an acceptable answer.
 
K

Kenny McCormack

and perhaps you will realize that I did go elsewhere when it became
the consensus that that is where my problem lay. Something I did not
realize until I came here, but then again that is why I did come here,
despite arrogant elitists, who think analyzing and questioning my
reasons for doing something is an acceptable answer.

Welcome to CLC. It's a fun newsgroup, as long as you realize that the
one thing you will never get here, from the "regs" is useful advice or
ever a kind word. The only people who give useful advice here are the
so-called trolls (that's me, Twink, and Richard). They call us trolls
because we actually dare to thumb our noses at the ruling ethic and give
useful advice. The ruling ethic is, you never do this.

But it is a fun newsgroup for giving and getting abuse.
 
C

CBFalconer

Flash said:
Kenny McCormack wrote, On 26/09/08 18:14:
.... snip ...


Bollocks. Using start did not solve the OPs problem, as started
by the OP above by the OP. Asking in an appropriate place would
have given him an answer far faster. It would probably have also
told him about the massive security hole he has just opened on
the PCs.

I suggest that the part of your message that needs isolation and
noticeability is the part about the security hole. We don't really
care what the troll knows, but we do care about the misinformation
he is passing.

Repeat - SECURITY hole.
 
C

CBFalconer

jleslie48 said:
and perhaps you will realize that I did go elsewhere when it
became the consensus that that is where my problem lay.
Something I did not realize until I came here, but then again
that is why I did come here, despite arrogant elitists, who
think analyzing and questioning my reasons for doing something
is an acceptable answer.

And perhaps you will realize that users who simply address the
topicality of a query, and redirect you in the general direction of
a better newsgroup, are in no way arrogant elitists. However the
trolls who insist on presenting off-topic information, in the full
knowledge that it is off-topic, are very definitely the arrogant
elitists.

Also, you need to train yourself to not delete attributions for any
quoted material. The attributions are those initial "Joe wrote:"
lines.
 
I

Ian Collins

CBFalconer said:
I suggest that the part of your message that needs isolation and
noticeability is the part about the security hole. We don't really
care what the troll knows, but we do care about the misinformation
he is passing.

Repeat - SECURITY hole.
Too late, the OP already has window installed :)
 
K

Kenny McCormack

CBFalconer said:
And perhaps you will realize that users who simply address the
topicality of a query, and redirect you in the general direction of a
better newsgroup, are in no way arrogant elitists.
Nonsense.

However the trolls who insist on presenting off-topic information, in
the full knowledge that it is off-topic, are very definitely the
arrogant elitists.
Nonsense.

Also, you need to train yourself to not delete attributions for any
quoted material. The attributions are those initial "Joe wrote:"
lines.

Nonsense.
(See recent thread that explains, via Gordon Burditt, why this [clipping
the attributions] is entirely sensible)

0 for 3. Par for the course for you, Chuckie.
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top