home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 25: Programming / pc_actual_25.iso / Java / JavaSplit / FILEDATA.DAT / javasp~1 / doc / start.c < prev   
Encoding:
C/C++ Source or Header  |  1998-07-13  |  679 b   |  40 lines

  1.         
  2.         /*
  3.             
  4.             Start.c
  5.             
  6.             Simple program to give system 
  7.             commands from a file.    
  8.         
  9.             Possible use: start other programs like
  10.             for example a Java interpretor.    
  11.  
  12.     
  13.         */
  14.             
  15.         #include<stdio.h>
  16.         #include<stdlib.h>
  17.             
  18.         /* maximum length of command in file */
  19.         static int COMMAND_LENGTH = 100;
  20.         
  21.         /* the filepath to the file containing the command */
  22.         static char *PATH_FILE = "path.txt";
  23.         
  24.         
  25.         int main()
  26.         {        
  27.             FILE *f;
  28.             char buf[ COMMAND_LENGTH ];
  29.             int e = 0; 
  30.         
  31.              f = fopen( PATH_FILE, "r");
  32.         
  33.             if( f != NULL )
  34.             {        
  35.                 fgets( buf, COMMAND_LENGTH + 1 , f ); 
  36.                 e = system( buf );
  37.             }
  38.             
  39.             exit( e );
  40.         }