So I want to read 2 lines from a .csv file,but for some reason when there is another empty line,fgets reads it as well which means I get an extra loop which I dont want. When I try to break the loop by checking if the first element of the buffer array (which if I understand correctly,is "refreshed" after every execution of the fgets command,didn't find much info on this) is Null or the New Line character,nothing happens. The .csv looks like this:
Title,Year,Genre,CastSize,Actors
Movie 1,1991,Genre 1,2,[Actor 1,Actor 2]
Code like this:
for (;!feof(fp);){
fgets(buffer,500,fp);
if (buffer[0]=='\n' || buffer[0]=='\0'){break;}
......
(When the extra blank line isn't there in the .txt,I get my two loops done correctly.)