#include #include #include #define LENGTH 32 int hasSpaces(char *s){ return (*s == ' ') ? 1 : 0; } int main(){ FILE *f = fopen("lsp.out","r"); char t1[2][LENGTH]; int space; int s=0; while(fgets(t1[s],LENGTH,f)){ space = hasSpaces(t1[s]); t1[s][strlen(t1[s])-1]=0; if(!space){ // printf("%s\n",t1); }else { while(space){ printf("jack_connect %s %s\n",t1[s^1],t1[s]); fgets(t1[s],LENGTH,f); space = hasSpaces(t1[s]); } fseek(f,-1*strlen(t1[s]),SEEK_CUR); } s^=1; } close(f); return 0; }