Public feed
#890755
/*
Music tagger
*/
#include<stdio.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
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, "<p><albumheader>");
strcat (theLINE, theline);
strcat (theLINE, "</albumheader></p>");
fprintf(out, "%s\n", theLINE);
}else{
strcpy (theLINE, "<p><artistheader>");
strcat (theLINE, theline);
strcat (theLINE, "</artistheader></p>");
fprintf(out, "%s\n", theLINE);
}
}
fclose(in);
fclose(out);
return 0;
}