home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sams Teach Yourself C in 21 Days (6th Edition)
/
STYC216E.ISO
/
mac
/
Examples
/
Day13
/
system.c
< prev
next >
Wrap
C/C++ Source or Header
|
2002-05-04
|
525b
|
30 lines
/* Demonstrates the system() function. */
#include <stdio.h>
#include <stdlib.h>
int main( void )
{
/* Declare a buffer to hold input. */
char input[40];
while (1)
{
/* Get the user's command. */
puts("\nInput the desired system command, blank to exit");
gets(input);
/* Exit if a blank line was entered. */
if (input[0] == '\0')
exit(0);
/* Execute the command. */
system(input);
}
return 0;
}