配置文件如: (文件名为config.txt)
file_in_L: good
file_in_R: nice
file_out_R: hi
file_residual: good
file_vector: very
代码如下:
char str[512];
char seps[] = " ,/t/n";
char *token;
int i;
char argv[5][20];
for(i=0;i<5;i++)
{
fgets(str,512,config);
token = strtok( str, seps );
printf("%s:",token);
token = strtok( NULL, seps );
printf( "%s/n", token );
strcpy(argv[i],token);
}