Re: Problem in calling c programs and compiling them in tcl/tk

Alexandre Ferrieux wrote:
On Nov 11, 11:23 am, vasavi.n...@xxxxxxxxx wrote:
I have been assigned to open a directory with c
programs in it using tcl/tk. Later I am supposed to c ompile all those
c programs in that directory one after another using tclk/tk.
I am able to open the directory and read all the c files. But when it
comes to compiling them am not able to do it at all. I have tried
using exec gcc filename.c and later exec ./a.out filename.c. For
example , if i take helloworld.c program & write above 2 steps , its
showing the o/p as "helloworld" . But it's also saying like child
process exited abnormally. Please can one suggest a simple command to
execute c programs . All the fork and thread concepts are quite new
and confusing to me. Isn't there any simple command in tcl from which
i can call a c program and compile it ?
I have spent nearly 4 days about this problem.But no idea at all.
Please if anyone can solve this , reply soon , if possible with an
example . I am supposed to complete it with in 1 day more.

You're being hit by the one single worst design mistake in Tcl's
history: the fact that [exec] barfs by default if the child process
writes to its stderr. That's stupid, idiot, dumb, and criminal. That
helped detect errors in one or two long-dead programs that failed to
use their exit status for abnormal exits, and that has spoilt the Tcl
experience of just about everyone else ever since :-)

The fix is trivial: [exec ... 2>@ stderr].

Or [exec -ignorestderr ...]

As you say, the workaround is trivial, and you can easily wrap it:

interp alias {} myexec {} exec -ignorestderr

If the "single worst design mistake in Tcl" is really something with a trivial 1-line fix, then Tcl must surely be perfection!

-- Neil