C/C++文件编译小工具

#include   <direct.h> 
#include   <stdlib.h> 
#include   <stdio.h> 
#include   <string.h>

void   main(   void   ) 
{ 
      char   buffer[_MAX_PATH]; 
char split[]="\\";
   char file[256];
char command[_MAX_PATH]="cmd /c gcc ";
      /*   Get   the   current   working   directory:   */ 
      if(   _getcwd(   buffer,   _MAX_PATH   )   ==   NULL   ) 
            perror(   "_getcwd   error "   ); 
      else 
            printf(   "%s\n ",   buffer   ); 

strcat(buffer,split);

strcat(command,buffer);

scanf("%s",&file);


strcat(command,file);


	system(command );
printf("%s",command);
scanf("%s",&file);

} 
posted @ 2011-04-24 00:08  吕飞  阅读(481)  评论(2编辑  收藏  举报