The difference in string and char[], readf() and scanf()

FG via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Mar 21 14:23:33 PDT 2015


On 2015-03-21 at 22:15, FG wrote:
> On 2015-03-21 at 21:02, Dennis Ritchie wrote:
>>> In what universe?! Which OS, compiler and architecture?
>> Windows 8.1 x64, dmd 2.066.1:
>
> That's strange. I cannot recreate the problem on Win7 x64 with dmd 2.066.1, neither when compiled for 32- nor 64-bit. I have saved the a's to a file and use input redirect to load it, while the program is as follows:

Oh, wait. I was wrong. I have the same problem. It didn't appear before because the file of A's that I used didn't have a \r\n EOL at the end. With those two bytes added it failed. It's the EOL at the end of the input word that's the problem. I tested four different inputs:

aaa...aaa           OK
aaa...aaa\r\n       FAIL
aaa...aaa bbb       OK
aaa...aaa bbb\r\n   OK


More information about the Digitalmars-d-learn mailing list