Can’t figure out why my print statement keeps printing out twice

hey guys so I have this code i'm working with and it's doing everything i need it to do, however, i can't figure out why my print f is printing out twice for level. here's the code.

while(fgets(str_read, sizeof(str_read)-1 , fptr)!= NULL)

sscanf(str_read, "%d ", &somearray->level);

printf("level: %d\n", somearray->level);

also if there is anything else i could work on im open to feed back. i'm working with a .txt file that has the following setup int name int name int name

Read more here:

Content Attribution

This content was originally published by Ryanv048 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: