#include #include #define STRLEN 65536 int main(void){ char q[STRLEN], command[STRLEN]; char dir[64] = "../router_01"; FILE *fp; fp = fopen("q.txt", "r"); if(fp == NULL){ printf("File does not exist.\n"); exit(1); } int counter = 1; while(1){ if(fscanf(fp, "%s", q) == EOF) break; printf("Q. %d\n", counter++); sprintf(command, "./%s/sim.exe %s", dir, q); //printf("(command) %s\n", command); int ret = system(command); printf("ret: %d\n", ret); } fclose(fp); return 0; }