Re: system_exec()

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi Al, thanks for your reply.

> Juergen Luethje wrote:
>>
>> Hi all,
>>
>> I recently noticed, that on my system (Win 98/1st ed., Eu 2.4), after
>> calling 'system_exec("foo.exe", i)' my interpreted Eu program doesn't
>> continue with the next statement, but waits, until execution of
>> 'foo.exe'
>> is finished. For instance try:
>>    if system_exec("calc", 2) then end if
>>    puts(1, "Hi there.")
>>    if getc(0) then end if
>>
>> This behaviour is very useful in certain situations. Unfortunately, I
>> noticed it, when I had almost finished writing my own routine with this
>> functionality. getlost
>> At least on Win 98/1st ed., system() behaves differently. It does *not*
>> wait for the termination of the called program.
>>
>> Is the behaviour of system()/system_exec() the same on all windows
>> platforms? How about Linux/FreeBSD? I think this should be clearly
>> documented.
>>
>
> Hi Juergen,
>
> I myself only use those functions when there is absolutely no
> other way of doing something smile

Me too. smile
However, since I came across this issue, I'd like to know, whether or
not system() always calls another program asynchronously, and
system_exc() always does this synchronously. Just because I'd like to
know as much as possible about "my" programming language. smile

> Can you use the win api?

Yes. As I mentioned, I have almost finished writing a routine, that
seems to be something like a self-written system_exec() function.
It uses the Win Api functions CreateProcess() and WaitForSingleObject().
But if system_exec() has the same functionality, why use a self-written
function instead?

I am writing a "wrapper" for the Eu2C Translator, so that there is the
additional command-line option '-res <resource file>' available.
This is simple and straightforward. The program just checks the
command-line options, and if '-res <resource file>' is given, this will
be extracted from the command line.
Then the statement
   x = system_exec("ecw.exe " & CommandLine, 2)
is executed.

If '-res <resource file>' was not given on the command-line, this was
just an awkward way of calling the translator. smile

If it was given, my program inserts additional lines into the files
"emake.bat" and "main_.c". Of course, these files are produced by the
translater, and I think my program shouldn't try to change them, before
the translater has finised it's work.

Best regards,
   Juergen

-- 
 /"\  ASCII ribbon campain  |    |\      _,,,---,,_
 \ /  against HTML in       |    /,`.-'`'    -.  ;-;;,_
  X   e-mail and news,      |   |,4-  ) )-,_..;\ (  `'-'
 / \  and unneeded MIME     |  '---''(_/--'  `-'\_)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu