/* Music tagger */ #include #include #include #include int main(int argc, char** argv) { FILE *in, *out; char theLINE[100]; char theline[100]; if(argc != 3) { printf("syntax: tagger infile outfile \n"); return 0; } in = fopen(argv[1], "r"); if(in == NULL) { printf("Unable to open file %s for reading. \n", argv[1]); exit(1); } out = fopen(argv[2], "w"); if(out == NULL) { printf("Unable to open file %s for writing. \n", argv[2]); exit(1); } while(fscanf(in, "%s", theline)!=EOF) { if(theline[0]=='-'){ strcpy (theLINE, "

"); strcat (theLINE, theline); strcat (theLINE, "

"); fprintf(out, "%s\n", theLINE); }else{ strcpy (theLINE, "

"); strcat (theLINE, theline); strcat (theLINE, "

"); fprintf(out, "%s\n", theLINE); } } fclose(in); fclose(out); return 0; }