All pastes #939772 Raw Edit

C

public c v1 · immutable
·published 2008-03-12 15:54 UTC
rendered paste body
#include <stdio.h>#include <string.h>#include <stdlib.h>#define LENGTH	32int 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;}