: 0x0D 0x0A (Win...">

Why are these two not equal?

Snippet of the first code

fscanf (Fp, "%d",&Variable);
fseek  (Fp, 2, SEEK_CUR); // Ignore <Enter>: 0x0D 0x0A (Windows Platform)
fread  (&String, sizeof(char), Length, Fp);

Snippet of the second code

fscanf (Fp, "%d\r\n",&Variable); // Ignore <Enter>: 0x0D 0x0A (Windows Platform)
fread  (&String, sizeof(char), Length, Fp);

Input file

13
    Foobar

The first code can get four white spaces before Foobar, but the second cannot.

Why? Thanks.

PS: If possible, please help me rename the topic to make it more specific. Appreciate your help.

+4
source share
2 answers

fscanf, , . , . , \r\n , , .

+5

fscanf...

( ),

http://en.cppreference.com/w/c/io/fscanf

"\n" , , F "Foobar"

+1

All Articles