Nikpa Nikpa - 8 days ago 6
C Question

Read File: fscanf doesn't read whitespaces?

I have a problem fetching lines from File Pointer using fscanf.

Let's say a want to fetch a line like this:

<123324><sport><DESCfddR><spor ds>


Fscanf fetch only this part:

<123324><sport><DESCfddR><spor


Does anybody know how to overcome this problem?

Thanks in advance.

Answer

In conclusion,the best way to read lines which contain whitespaces is to use fgets:

fgets (currentLine, MAX_LENGTH , filePointer);

Using fscanf you are going to mess with a lot of problems.