home *** CD-ROM | disk | FTP | other *** search
-
- /*
-
- Start.c
-
- Simple program to give system
- commands from a file.
-
- Possible use: start other programs like
- for example a Java interpretor.
-
-
- */
-
- #include<stdio.h>
- #include<stdlib.h>
-
- /* maximum length of command in file */
- static int COMMAND_LENGTH = 100;
-
- /* the filepath to the file containing the command */
- static char *PATH_FILE = "path.txt";
-
-
- int main()
- {
- FILE *f;
- char buf[ COMMAND_LENGTH ];
- int e = 0;
-
- f = fopen( PATH_FILE, "r");
-
- if( f != NULL )
- {
- fgets( buf, COMMAND_LENGTH + 1 , f );
- e = system( buf );
- }
-
- exit( e );
- }