473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

I've written a cgi program in C using the borland 5.5 free compiler,
and it runs just fine on an Apache server.

My only issue is if I issue some system calls the cgi suspends until
the call finishes. for example if in my c program I have a line:

system("notepad");
I can see with the taskmanager that an instance of notepad.exe is
running, but its not on my desktop and the cgi program that made the
system call suspends until I kill the notepad.exe process.

I even tried imbedding the the notepad call in a .bat file as so:

system("mybatfile.bat");

mybatfile.bat:
REM call a routine
notepad t.txt
I get the same result.

If I re-write mybatfile.bat to some routine that completes
automatically, all goes well for example:

mybatfile.bat:
REM a simple canned routine
dir >t.txt

this works fine and sure enough, there is a new file named t.txt
created.

What is the right way to call notepad from a cgi, I imagine one of the
variations of spawn() or exec() will do the trick; I'm hoping some
here will know.

TIA,

Jon

Sep 22 '08 #1
35 4539
jleslie48 wrote:
I've written a cgi program in C using the borland 5.5 free compiler,
and it runs just fine on an Apache server.
This isn't really a C question, its more a web/cgi programming question
and the answers depend on your operating system's support for running
multiple processes at once rather than on C. I'd suggest a newsgroup
specialising in such stuff.

Meantime you might want to read your compiler's manual to see if it has
functions called spawn... or ShellExec or similar.
Sep 22 '08 #2
jleslie48 wrote, On 22/09/08 21:55:
I've written a cgi program in C using the borland 5.5 free compiler,
and it runs just fine on an Apache server.
Well, CGI's are not topical here, nor is your main problem which is a
fundamental miss-understanding of things.
My only issue is if I issue some system calls the cgi suspends until
the call finishes.
The C standard allows it to work that way.
for example if in my c program I have a line:

system("notepad");
Now, why on earth would you want to call notepad from a CGI? Where do
you expect notepad will run? Where do you expect notepad to display its
Window? Remember that notepad is a Windows program that pre-dates
Windows having built-in support for networking.

<snip>
I even tried imbedding the the notepad call in a .bat file as so:

system("mybatfile.bat");

mybatfile.bat:
REM call a routine
notepad t.txt
Why would you get anything different?

<snip>
What is the right way to call notepad from a cgi,
There is not a correct way to do this. I don't know what you are trying
to achieve, but whatever it is you are trying to use the wrong method.
Ask in a web-development group (or web forum) about the real problem
that you are trying to solve.
I imagine one of the
variations of spawn() or exec() will do the trick;
Neither of those are standard C and I don't think they are standard
Windows API calls either.
I'm hoping some
here will know.
You are in luck that someone here can see that whatever you want to do
you are using completely the wrong approach. As I say above, ask about
your real problem (you no, the one you think can be solved by running
notepad) in a web development group.
--
Flash Gordon
If spamming me sent it to sm**@spam.causeway.com
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/
Sep 22 '08 #3
In article <69**********************************@d77g2000hsb. googlegroups.com>,
jleslie48 <jo*@jonathanleslie.comwrote:
>My only issue is if I issue some system calls the cgi suspends until
the call finishes. for example if in my c program I have a line:

system("notepad");
I can see with the taskmanager that an instance of notepad.exe is
running, but its not on my desktop and the cgi program that made the
system call suspends until I kill the notepad.exe process.
I take it this is Microsoft Windows, which I'm not really familiar
with, so this is just guesswork: in the other windowing operating
systems I've used it's non-trivial for a "daemon" process like a web
server to start up programs that display in the window system. For
one thing, which user's desktop would they appear on? There is
usually some inherited context (such as the DISPLAY environment
variable in X on unix) that indicates that a program is running under
the window system.

Presumably there is documentation on the Microsoft web site about how
to do this, but I can't help with finding it.

You also have to consider just what it is you want to happen: what
good does it do for a CGI script to open something on the desktop?
Are you assuming that it's the person sitting at the screen who
has caused the script to be run?

-- Richard
--
Please remember to mention me / in tapes you leave behind.
Sep 22 '08 #4
On Sep 22, 4:55*pm, jleslie48 <j...@jonathanleslie.comwrote:
I've written a cgi program in C using the borland 5.5 free compiler,
and it runs just fine on an Apache server.

My only issue is if I issue some system calls the cgi suspends until
the call finishes. *for example if in my c program I have a line:

system("notepad");

I can see with the taskmanager that an instance of notepad.exe is
running, but its not on my desktop and the cgi program that made the
system call suspends until I kill the notepad.exe process.

I even tried imbedding the the notepad call in a .bat file as so:

system("mybatfile.bat");

mybatfile.bat:
REM call a routine
notepad t.txt

I get the same result.

If I re-write mybatfile.bat to some routine that completes
automatically, all goes well for example:

mybatfile.bat:
REM a simple canned routine
dir >t.txt

this works fine and sure enough, there is a new file named t.txt
created.

What is the right way to call notepad from a cgi, I imagine one of the
variations of spawn() or exec() will do the trick; I'm hoping some
here will know.

TIA,

Jon
Thanks to all for your input. for reference purposes, I'm using a
windoze xp pro OS, the borland 5.5 C++ compiler, an apache server, and
no damned visual studio bloatware or windoze api behemoth. Just plain
old c, putting out plain old ascii, that the apache server sends out
to a browser that understands it as HTML code, nice and simple, ports
to any linux, any windoze OS, or HP-UX machine. The fact that its a
cgi is rather minor, accept that for some reason that I expect has to
do with the parent-child inheritance rules, the system call doesn't
launch the notepad process on the screen or the task bar at the
bottom.

I fully understand that this is a non-standard use of cgi, and I was
only expecting to use this utility in a http://localhost environment,
viz, the apache server that is responding to the form request from the
browser are on the same machine. In other words, I want to open a
browser window on the machine that is running the apache server, and
have it open a notepad session on a file that I want the nighttime
operator to do some changes to.

I've looked around for better fit usergroups, but after an hour or so,
this one seemed to be the only one that at least talks about
programming in C. None of the others seem to do any real
programming.

Sep 22 '08 #5
>I've written a cgi program in C using the borland 5.5 free compiler,
>and it runs just fine on an Apache server.
CGI runs on a *server*. A server need not even have a monitor.
Even if it does, it may be used only when the system is rebooted,
and shared with a dozen other systems via a big KVM switch.
>My only issue is if I issue some system calls the cgi suspends until
the call finishes. *for example if in my c program I have a line:

system("notepad");
What does
system("notepad &");
do? It might avoid the suspension until the call finishes (it would
on UNIX), or it might just result in notepad complaining about its
command-line arguments.
>I can see with the taskmanager that an instance of notepad.exe is
running, but its not on my desktop and the cgi program that made the
system call suspends until I kill the notepad.exe process.
system() is not going to make anything run on a remote machine unless
the command is very specific about what machine it's supposed to run
on, and all sorts of permissions are set properly. Otherwise:
system("virus");
would be nearly unstoppable.
>I even tried imbedding the the notepad call in a .bat file as so:

system("mybatfile.bat");

mybatfile.bat:
REM call a routine
notepad t.txt

I get the same result.

If I re-write mybatfile.bat to some routine that completes
automatically, all goes well for example:

mybatfile.bat:
REM a simple canned routine
dir >t.txt

this works fine and sure enough, there is a new file named t.txt
created.
>What is the right way to call notepad from a cgi,
I don't believe there is one.
>I imagine one of the
variations of spawn() or exec() will do the trick; I'm hoping some
here will know.
Notepad needs to have a display to function. I don't know how you
give it one. Apache isn't prepared to open windows for CGIs to run
in. On UNIX, you'd need to redirect standard input and standard
output to a terminal or pseudo-terminal. Then there's the problem
that two programs (e.g. notepad and a shell) reading from the
keyboard at the same time gives you problems with the output going
to the correct place.

Sep 22 '08 #6
In article <6f**********************************@f63g2000hsf. googlegroups.com>,
jleslie48 <jo*@jonathanleslie.comwrote:
>On Sep 22, 4:55*pm, jleslie48 <j...@jonathanleslie.comwrote:
>I've written a cgi program in C using the borland 5.5 free compiler,
and it runs just fine on an Apache server.

My only issue is if I issue some system calls the cgi suspends until
the call finishes. *for example if in my c program I have a line:

system("notepad");
Your explanation makes everything clear. Ignore the retards who
continue to pretend either that they have no idea what you are talking
about or assume (despite all your statements to the contrary) that you
are running on Unix and/or a headless server box.

Anyway, I think what you are looking for is:

system("start notepad");

That is, incidentally, the equivalent of:

system("notepad &");

in the Unix world...

Sep 22 '08 #7
go***********@burditt.org (Gordon Burditt) writes:
[...]
>jleslie48 <jo*@jonathanleslie.comwrites:
>>I've written a cgi program in C using the borland 5.5 free compiler,
and it runs just fine on an Apache server.

CGI runs on a *server*. A server need not even have a monitor.
Even if it does, it may be used only when the system is rebooted,
and shared with a dozen other systems via a big KVM switch.
>>My only issue is if I issue some system calls the cgi suspends until
the call finishes. *for example if in my c program I have a line:

system("notepad");

What does
system("notepad &");
do? It might avoid the suspension until the call finishes (it would
on UNIX), or it might just result in notepad complaining about its
command-line arguments.
The OP is running on Windows XP. Appending "&" to the command will do
nothing useful. For details, as in a Windows newsgroup.

To the original poster: There is (or was) a newsgroup that discusses
CGI programming, comp.infosystems.www.authoring.cgi. Or you can try
comp.os.ms-windows.programmer.win32. I don't think you'll get any
directly useful information in comp.lang.c, just suggestions to ask
elsewhere (which is useful, but only indirectly) and bad guesses.

I've restored the attribution line that Gordon snipped. Permission to
quote this article without attribution is denied.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Sep 22 '08 #8
Kenny McCormack wrote, On 23/09/08 00:30:
In article <6f**********************************@f63g2000hsf. googlegroups.com>,
jleslie48 <jo*@jonathanleslie.comwrote:
>On Sep 22, 4:55 pm, jleslie48 <j...@jonathanleslie.comwrote:
>>I've written a cgi program in C using the borland 5.5 free compiler,
and it runs just fine on an Apache server.

My only issue is if I issue some system calls the cgi suspends until
the call finishes. for example if in my c program I have a line:

system("notepad");

Your explanation makes everything clear.
It makes it clear the OP is trying to do something that won't work.
Ignore the retards who
continue to pretend either that they have no idea what you are talking
about or assume (despite all your statements to the contrary) that you
are running on Unix and/or a headless server box.
I made none of those assumptions.
Anyway, I think what you are looking for is:

system("start notepad");
Which won't work for the OP for precicely the same reasons that the OP
is not getting notepad displayed currently.
That is, incidentally, the equivalent of:

system("notepad &");

in the Unix world...
Something I at least was fully aware of. I did not suggest it because it
does not solve the OP's problem, and if Apache is even vaguely sensibly
designed it will make it as hard as possible to launch a usable instance
of notepad and Windows will actually cooperate in making it hard. This
is why the OP needs to discuss the real problem somewhere it is topical,
a completely different solution will be required.
--
Flash Gordon
If spamming me sent it to sm**@spam.causeway.com
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/
Sep 23 '08 #9
In article <6t************@news.flash-gordon.me.uk>,
Flash Gordon <sp**@flash-gordon.me.ukwrote:
>Kenny McCormack wrote, On 23/09/08 00:30:
>In article
<6f**********************************@f63g2000hsf .googlegroups.com>,
>jleslie48 <jo*@jonathanleslie.comwrote:
>>On Sep 22, 4:55 pm, jleslie48 <j...@jonathanleslie.comwrote:
I've written a cgi program in C using the borland 5.5 free compiler,
and it runs just fine on an Apache server.

My only issue is if I issue some system calls the cgi suspends until
the call finishes. for example if in my c program I have a line:

system("notepad");

Your explanation makes everything clear.

It makes it clear the OP is trying to do something that won't work.
Maybe, maybe not. But the OP's specific problem - the reason he posted
(go back and look at the original text if you like) - was that the
system() function was "hanging" (a word that probably doesn't occur in
your precious "standard", but I think you know what I mean). He could
tell from "task manager" (or whatever system processes monitoring
software he is using) that notepad was running, but the problem was that
his batch file was "hanging". Using "start" will fix that. So, I have
answered the question as posted.

Now, as for whether or not that will cause a window to pop up on the
operator's screen - that's another question entirely. But that was *not*
the question posted. If that is an issue for the OP (and we have no way
of knowing whether it is - but I see that you have made your usual set
of assumptions), then that fact will come out eventually, and we can
deal with it when it does.

Sep 23 '08 #10
Kenny McCormack wrote, On 23/09/08 21:58:
In article <6t************@news.flash-gordon.me.uk>,
Flash Gordon <sp**@flash-gordon.me.ukwrote:
>Kenny McCormack wrote, On 23/09/08 00:30:
>>In article
<6f**********************************@f63g2000hsf .googlegroups.com>,
>>jleslie48 <jo*@jonathanleslie.comwrote:
On Sep 22, 4:55 pm, jleslie48 <j...@jonathanleslie.comwrote:
I've written a cgi program in C using the borland 5.5 free compiler,
and it runs just fine on an Apache server.
>
My only issue is if I issue some system calls the cgi suspends until
the call finishes. for example if in my c program I have a line:
>
system("notepad");
Your explanation makes everything clear.
It makes it clear the OP is trying to do something that won't work.

Maybe, maybe not.
Well, if you think the OP was trying to generate a hung process you
could have suggested easier methods.
But the OP's specific problem - the reason he posted
(go back and look at the original text if you like) - was that the
system() function was "hanging" (a word that probably doesn't occur in
your precious "standard", but I think you know what I mean). He could
I know exactly what he meant, and from the fact that he comments, "but
its not on my desktop" it is obvious to anyone who knows about Windows
and notepad that this is a problem.

<snip>
Now, as for whether or not that will cause a window to pop up on the
operator's screen - that's another question entirely.
Now you are doing exactly what you complain about the "regs", including
me, doing and deliberately not dealing with the problem the OP obviously
has.
But that was *not*
the question posted.
It *was* included in the original post.
If that is an issue for the OP (and we have no way
of knowing whether it is - but I see that you have made your usual set
of assumptions),
You mean assuming the OP wants a solution that will work?
then that fact will come out eventually, and we can
deal with it when it does.
The only facts required to know the OP is barking up a tree in
completely the wrong forest were in the original post. If you don't know
enough about Windows to know that then don't complain at people who *do*
know enough for telling someone they need a completely different approach.
--
Flash Gordon
If spamming me sent it to sm**@spam.causeway.com
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/
Sep 23 '08 #11
On Sep 22, 4:55*pm, jleslie48 <j...@jonathanleslie.comwrote:
I've written a cgi program in C using the borland 5.5 free compiler,
and it runs just fine on an Apache server.

My only issue is if I issue some system calls the cgi suspends until
the call finishes. *for example if in my c program I have a line:

system("notepad");

I can see with the taskmanager that an instance of notepad.exe is
running, but its not on my desktop and the cgi program that made the
system call suspends until I kill the notepad.exe process.

I even tried imbedding the the notepad call in a .bat file as so:

system("mybatfile.bat");

mybatfile.bat:
REM call a routine
notepad t.txt

I get the same result.

If I re-write mybatfile.bat to some routine that completes
automatically, all goes well for example:

mybatfile.bat:
REM a simple canned routine
dir >t.txt

this works fine and sure enough, there is a new file named t.txt
created.

What is the right way to call notepad from a cgi, I imagine one of the
variations of spawn() or exec() will do the trick; I'm hoping some
here will know.

TIA,

Jon
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. From the borland help files I can see that exec() and
spawn() have a whole host of variations and flavors, changing the
rules of dependency, parent-child status etc. I guess I just have to
use trial and terror to see. I was hoping someone would have tried
something like this. Maybe fork() would also work, however, that is
the one that I would of expected to fail though, as that WOULD work
with exactly the same envrionment as the apache server, aka, as a
background task without a user interface.

I highly doubt I'm running into any security issue, as there is
nothing from preventing me from executing a bat file that "del/q/f/s c:
\windows" as that command requires no user input. You'd think the boys
as Microsoft would of plugged that one before silly old notepad.

quite frankly I don't think this is a big stretch for this group.
This is pretty straightforward C programming, and not a cgi issue.
Most cgi programmers would be lost in the C world, and all their GUI
"write software for me" packages just make a mess out of understanding
things, so those folks are mostly useless. I think if you write any
background task for windoze xp and have it launch notepad I would have
the same issue, but I don't even know how I could write that. I'm
just a simple old command line programmer.

The html/cgi/forms environment is a very easy interface to work with,
gives me full access to all the installed files and software on my
computer, and I'm really just using the apache server as a means to a
nice interface so that the interns who run the place at night can be
trained much faster and their jobs are made as simple as possible.
Using this technique I've managed to get a whole host of things done
that I never could of without a staff of nighttime operators that were
much more computer literate. Now I want them to be dropped into a
notepad session for whatever reason I have. That reason is
unimportant. I'm quite sure it can be done. Heck the dos prompt does
it.

Sep 24 '08 #12
jleslie48 <jo*@jonathanleslie.comwrites:
[...]
quite frankly I don't think this is a big stretch for this group.
This is pretty straightforward C programming, and not a cgi issue.
Most cgi programmers would be lost in the C world, and all their GUI
"write software for me" packages just make a mess out of understanding
things, so those folks are mostly useless. I think if you write any
background task for windoze xp and have it launch notepad I would have
the same issue, but I don't even know how I could write that. I'm
just a simple old command line programmer.
[...]

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

Have you tried posting to comp.os.ms-windows.programmer.win32?

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Sep 24 '08 #13
jleslie48 wrote, On 24/09/08 01:39:

<snip>
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
Well, it won't work. Feel free to waste your time though.
completes, that at least solves half my problem and gets me closer to
a solution. From the borland help files I can see that exec() and
spawn() have a whole host of variations and flavors, changing the
They are non-standard and only Boreland programmers will know about
them. However, they definitely should *not* work.

<snip>
with exactly the same envrionment as the apache server, aka, as a
background task without a user interface.
Here you are getting closer to the problem, but there is more to it than
that.
I highly doubt I'm running into any security issue, as there is
nothing from preventing me from executing a bat file that "del/q/f/s c:
\windows" as that command requires no user input. You'd think the boys
as Microsoft would of plugged that one before silly old notepad.
It isn't notepad as such that is the problem. However, this is not the
correct place to discus it.
quite frankly I don't think this is a big stretch for this group.
This is pretty straightforward C programming, and not a cgi issue.
No, it's not a cgi problem, it's a Windows problem you would have with
all sorts of other software as well.
Most cgi programmers would be lost in the C world, and all their GUI
"write software for me" packages just make a mess out of understanding
things, so those folks are mostly useless.
Shows how little you know. I say that as someone who has written CGI's
in Unix and work with people who write web based applications.

<snip>
The html/cgi/forms environment is a very easy interface to work with,
gives me full access to all the installed files and software on my
computer, and I'm really just using the apache server as a means to a
nice interface so that the interns who run the place at night can be
trained much faster and their jobs are made as simple as possible.
Now you are finding out why it is the wrong tool for the job.
Using this technique I've managed to get a whole host of things done
that I never could of without a staff of nighttime operators that were
much more computer literate. Now I want them to be dropped into a
notepad session for whatever reason I have. That reason is
unimportant. I'm quite sure it can be done.
So ask somewhere they might know about the internals of Windows.
Heck the dos prompt does
it.
The DOS prompt is running in a *very* different context. If you don't
understand that then you are a long way from being able to understand
what the problem is, and until you understand the problem you are in no
position to udge whether it might be possible.
--
Flash Gordon
If spamming me sent it to sm**@spam.causeway.com
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/
Sep 24 '08 #14
Flash Gordon wrote:
jleslie48 wrote, On 24/09/08 01:39:
....
>completes, that at least solves half my problem and gets me closer to
a solution. From the borland help files I can see that exec() and
spawn() have a whole host of variations and flavors, changing the

They are non-standard and only Boreland programmers will know about
them. However, they definitely should *not* work.
I agree that they are non-standard, and therefore off-topic. However,
they are not Borland-specific; I've seen the same (or at least similar)
functions available on a wide variety of compilers.
Sep 24 '08 #15
On 24 Sep, 02:09, Keith Thompson <ks...@mib.orgwrote:
jleslie48 <j...@jonathanleslie.comwrites:
Have you tried posting to comp.os.ms-windows.programmer.win32?
this group is active and helpful.
They are much nicer than clc! :-)

--
Nick Keighley
Sep 24 '08 #16
Kenny McCormack wrote:
In article <QP**************@nwrddc02.gnilink.net>, James Kuyper
<ja*********@verizon.netwrote:
>Flash Gordon wrote:
>>jleslie48 wrote, On 24/09/08 01:39:
...
>>>completes, that at least solves half my problem and gets me
closer to a solution. From the borland help files I can see
that exec() and spawn() have a whole host of variations and
flavors, changing the
They are non-standard and only Boreland programmers will know
about them. However, they definitely should *not* work.
I agree that they are non-standard, and therefore off-topic.
However, they are not Borland-specific; I've seen the same (or at
least similar) functions available on a wide variety of compilers.

But that is the terminology of this newsgroup. If something is
implemented in 99% of the platforms that we care about (note that I
am not making that specific claim about the functions in question
here), they call it "implementation specific". ...
I would not have objected if he had called them "implementation
specific". That is exactly the correct term. He said that "only Boreland
programmers will know about them", and that is NOT correct.
... They are not using the word "specific" in the sense that
ordinary English speakers do.
Definition 4 a) at

<http://www.ask.com/web?q=dictionary%3A+specific&content=ahdict%7C5141 &o=0&l=dir>

is the one that is most closely related to the concept of
"implementation specific". The example given by that definition is
"age-specific voting patterns". That term means "voting patterns which
are different for different age groups". An "implementation-specific
value" means a "value which is different for different implementations".

It doesn't matter if 99% of the age groups all vote identically; if the
remaining 1% of the age groups vote in a significantly different
pattern, the voting pattern is age-specific. Similarly, it doesn't
matter if a function is provided by 99% of the implementations. If the
remaining 1% of the implementations do not provide it, then support for
that function is implementation-specific.

....
Total lack of common sense.
Common sense isn't what's it's cracked up to be. It's neither common,
nor sensical, nor is it a good guide to follow when discussions get
technical.

Common sense used to say that the world was, overall, flat. Only those
scholars in their Ivory towers with their heads in the clouds would
natter on about how the evidence (such as lunar eclipses) showed that
Earth had to be spherical. I would not recommend navigating a vessel on
any transoceanic voyages using such "common sense". Stick to
coastal-hopping, it's safer.
Sep 24 '08 #17
James Kuyper wrote, On 24/09/08 11:41:
Flash Gordon wrote:
>jleslie48 wrote, On 24/09/08 01:39:
...
>>completes, that at least solves half my problem and gets me closer to
a solution. From the borland help files I can see that exec() and
spawn() have a whole host of variations and flavors, changing the

They are non-standard and only Boreland programmers will know about
them. However, they definitely should *not* work.

I agree that they are non-standard, and therefore off-topic. However,
they are not Borland-specific; I've seen the same (or at least similar)
functions available on a wide variety of compilers.
I'm not aware of them being available on a wide variety of Windows
compilers and would not guarantee they behave the same as the Posix
functions with similar names or the MS functions with slightly different
names. However, I do accept that they are not necessarily specific to
Borland.
--
Flash Gordon
If spamming me sent it to sm**@spam.causeway.com
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/
Sep 24 '08 #18
]
>
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. 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.
Sep 26 '08 #19
Standard C has no concept of "background tasks", which is exactly why
this isn't the right place for your question.
I guess I'm running into trouble with the Windoze vs UNIX
implementations.
K&R and Pike detail very early on the relationship of C and the UNIX
OS with the "system", "exec", "fork", family of library functions as
some of the most
fundamental of the language.

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.
Sep 26 '08 #20
jleslie48 wrote:
>
.... snip ...
>
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.
You are very wrong. Standard C doesn't include exec or fork in any
form. Unix is not built on Standard C, if that means "limited to".

Some useful references about C:
<http://www.ungerhu.com/jxh/clc.welcome.txt>
<http://c-faq.com/ (C-faq)
<http://benpfaff.org/writings/clc/off-topic.html>
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf(C99)
<http://cbfalconer.home.att.net/download/n869_txt.bz2 (pre-C99)
<http://www.dinkumware.com/c99.aspx (C-library}
<http://gcc.gnu.org/onlinedocs/ (GNU docs)
<http://clc-wiki.net/wiki/C_community:comp.lang.c:Introduction>

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Sep 26 '08 #21
jleslie48 wrote:
]
>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.
Sep 26 '08 #22
On Sep 26, 11:43 am, James Kuyper <jameskuy...@verizon.netwrote:
jleslie48 wrote:
]
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.

Sep 26 '08 #23
In article <82**********************************@i76g2000hsf. googlegroups.com>,
jleslie48 <jo*@jonathanleslie.comwrote:
....
>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.

Sep 26 '08 #24
jleslie48 wrote, On 26/09/08 17:33:

<snip>
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.
--
Flash Gordon
If spamming me sent it to sm**@spam.causeway.com
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/
Sep 26 '08 #25
Kenny McCormack wrote, On 26/09/08 18:14:
In article <82**********************************@i76g2000hsf. googlegroups.com>,
jleslie48 <jo*@jonathanleslie.comwrote:
...
>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.
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.
--
Flash Gordon
If spamming me sent it to sm**@spam.causeway.com
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/
Sep 26 '08 #26
jleslie48 <jo*@jonathanleslie.comwrote:
>
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.
--
Larry Jones

He just doesn't want to face up to the fact that I'll be
the life of every party. -- Calvin
Sep 26 '08 #27
In article <t1************@news.flash-gordon.me.uk>,
Flash Gordon <sp**@flash-gordon.me.ukblustered:
....
>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.

Sep 26 '08 #28
In article <5c************@jones.homeip.net>,
<la************@siemens.comwrote:
>jleslie48 <jo*@jonathanleslie.comwrote:
>>
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.
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.

Sep 26 '08 #29
jleslie48 <jo*@jonathanleslie.comwrites:
]
>>
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.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Sep 26 '08 #30
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 s...@spam.causeway.com
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.

Sep 26 '08 #31
In article <4f**********************************@d77g2000hsb. googlegroups.com>,
jleslie48 <jo*@jonathanleslie.comwrote:
>
>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 s...@spam.causeway.com
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.
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.

Sep 26 '08 #32
Flash Gordon wrote:
Kenny McCormack wrote, On 26/09/08 18:14:
.... snip ...
>
>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.
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.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Sep 27 '08 #33
jleslie48 wrote:
>
>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.

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.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Sep 27 '08 #34
CBFalconer wrote:
Flash Gordon wrote:
>Kenny McCormack wrote, On 26/09/08 18:14:
.... snip ...
>>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.

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 :)

--
Ian Collins.
Sep 27 '08 #35
In article <48***************@yahoo.com>,
CBFalconer <cb********@maineline.netwrote:
....
>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.

Sep 27 '08 #36

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: mark1822 | last post by:
Hi, I am trying to figure out if I should learn C and C++ to write CGI programs, or if I should just use PHP for my web site. I want to write a high traffic website that would call executibles...
12
by: jrefactors | last post by:
If the C programs have UNIX system calls such as fork(), alarm(), etc.., we should call it UNIX programs, not traditional C programs? We couldn't compile the programs with system calls using VC++...
4
by: Alan Searle | last post by:
I would like to write values to the registry and am having problems with a very simple block of code. Here it is ... -------------------------------------------------------- Option Compare...
4
by: phantom | last post by:
Hi All. I am having a problem writing to a file. I can successfully open the file and write the contents using fprintf, however if the writing is not done for a while in the process the file...
0
by: s99999999s2003 | last post by:
hi in my environment, besides shell scripts written for sys admin tasks, there are shell scripts that call java programs which in turn will do various processing like connecting to databases and...
5
by: UJ | last post by:
I have a system that has five programs that all communicate with each other via Message Queues. Works well. One program is a watchdog that will make sure the others are up and going. Currently I...
22
by: JoeC | last post by:
I am working on another game project and it is comming along. It is an improvment over a previous version I wrote. I am trying to write better programs and often wonder how to get better at...
0
ashitpro
by: ashitpro | last post by:
Writing System Call Wrappers in User Space. Recently I saw a post in Linux/Unix section to know the user who deleted the file in linux. Currently there is nothing in linux which could achieve...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.