So I have a text file (called So.txt) that has in it:
Will
Happy
12.50
2012
Kanye
Wolves
15.99
2016
I'm writing a program that reads from it and adds a certain prefix to each read line. Basically I would like the output to look like this:
Name of singer: Will
Name of song: Happy
Price: 12.50
Year of release:2012
Name of singer: Kanye
Name of song: Wolves
Price: 15.99
Year of release:2016
This is the program.
song_file = fopen("So.txt", "r");
char singleline[150];
while (!feof(song_file) ) {
fgets(singleline, 150, song_file);
puts(singleline);
printf("Name of singer: ");
printf("Name of song: ");
printf("Price: ");
printf("Year of release: ");
}