I have a question concerning fgets and fscanf in C. What exactly is the difference between these two? For example:
fgets read until a newline (and also stores it).
fscanf with the
%s specifier reads until any blank space and doesn't store it...
As a side note, you're not specifying the size of the buffer in scanf and it's unsafe. Try:
fscanf(ptr, "%9s", str)