/* Line Break Conversion by cppig1995 */ /* Jan 02, 2006 -- [cppig1995] */ #include #include int main(int argc, char *argv[]) { FILE *fi, *fo; int c; if(argc != 3) { printf("Usage : uwconv [Source] [Destination]\n"); printf("Convert LF-only into CR-LF\n\n"); printf("Exit Code 0 is Success. If else returned : "); printf("Code 1 : File Process Error. Code 2 : Parameter Error.\n"); printf("If unknown exit code or error occured,\n"); printf("Please report it to cppig1995@gmail.com\n"); exit(2); } fi = fopen(argv[1], "r"); fo = fopen(argv[2], "w"); if(!(fi && fo)) exit(1); while((c = getc(fi)) != EOF) { if(c == '\n') putc('\r', fo); putc(c, fo); } }