#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);
}
转载于:https://www.cnblogs.com/lvfei/archive/2011/04/24/2025992.html