Unexpected Crash

default0 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 7 13:49:42 PDT 2016


On Thursday, 7 April 2016 at 20:47:35 UTC, Adam D. Ruppe wrote:
> On Thursday, 7 April 2016 at 20:42:17 UTC, default0 wrote:
>> If I enter "5,5,5" on the commandline, hit enter, then enter 
>> "5,5,5"
>
>
> When you hit enter, that puts a \n character in the buffer. 
> readf doesn't skip that automatically, so it complains upon 
> hitting that newline (the error message shows the character 
> *after* it though, which sucks).
>
>
> But what you want to do is to read whitespace too. I think 
> putting a space in the format string at the beginning or end 
> will do it (I don't use readf often though).

Changing the format string to "%d,%d,%d\n" fixed the problem. 
Would've figured if the error complained about '\n' instead of 
'5'.


More information about the Digitalmars-d-learn mailing list