Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How can I invoke another program (a standalone executable, or an operating system command) from within a C program?
How can I invoke another program (a standalone executable, or an operating system command) from within a C program?
✍: Guest
Use the library function system, which does exactly that.
Some systems also provide a family of spawn routines which accomplish approximately the same thing. system is more ``portable'' in that it is required under the ANSI C Standard, although the interpretation of the command string--its syntax and the set of commands accepted--will obviously vary tremendously.
The system function ``calls'' a command in the manner of a subroutine, and control eventually returns to the calling program. If you want to overlay the calling program with another program (that is, a ``chain'' operation) you'll need a system-specific routine, such as the exec family on Unix.
Note that system's return value is at best the command's exit status (although even that is not guaranteed), and usually has nothing to do with the output of the command. .
2015-03-18, 1179👍, 0💬
Popular Posts:
How To Set Up Breakpoints in Debug Mode? - Oracle DBA FAQ - Introduction to Oracle SQL Developer To ...
How do we host a WCF service in IIS? Note: - The best to know how to host a WCF in IIS is by doing a...
What does static variable mean? There are 3 main uses for static variables: If you declare within a ...
How can I show HTML examples without them being interpreted as part of my document? Within the HTML ...
How Are Vertical Margins between Two Block Elements Collapsed? - CSS Tutorials - Understanding Multi...