From: Brian D. <br...@de...> - 2005-10-14 10:38:14
|
Keith MARSHALL wrote: > Ah-ha, but most standard C libraries *do* have a feature which is > *very* closely analogous to the shell's backtick mechanism; it is > the `system( "command args ..." )' function :-) > > Unfortunately, when you use MinGW the system() function is that > provided by Microsoft, in MSVCRT, and it spawns Uh, I'd say that system() is analogous to the perl function of the same name, not backticks. system() runs the command and discards the output, and only returns the exit status. That is typically NOT what you want when you want the backtick behavior. popen() is the POSIX function that does the same thing as backticks, and luckily MSVCRT has _popen too. Brian |