Difference between fgets and fscanf?

The function 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)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)