How do I execute another program from within a C program in Windows 32 - in a similar way as Perl's system()
function or Python's sub-process module - such as DEL
, REG
, or other cmd.exe programs?
views:
132answers:
2
+2
A:
C does have a system
function in its standard library, see e.g. the wikipedia entry about it.
Alex Martelli
2010-04-25 03:17:57
Wow, I didn't think that such a low-level (and somewhat old) language would still have a system() function just like higher-level languages such as Perl.
Bushman
2010-04-25 03:30:10
If I had to guess, I'd say perl's system derives from C's.
WhirlWind
2010-04-25 03:33:15
Now that I think about it, and also that I compare C's control-flow statements and variable typing to that of Perl, Mr. Wall was quite clever in making Perl's syntax so similar to C's (easier to compile into C). Which confuses me even more why I can't find anything to convert perl code into a nice stand-alone, no-interpreter-included, fully Windows-compatible, .c source.
Bushman
2010-04-25 18:25:23
A:
You can use: system():, popen(), CreateProcess(), maybe even others. Just search for them in http://msdn.microsoft.com.
vanza
2010-04-25 03:19:48