Scanf function changes value of in-loop variable

FreeSlave freeslave93 at gmail.com
Wed Apr 16 12:14:23 PDT 2014


On Wednesday, 16 April 2014 at 18:46:18 UTC, Ali Çehreli wrote:
> On 04/16/2014 11:36 AM, FreeSlave wrote:
>> Note that readf is not equivalent to scanf since readf does 
>> not skip
>> spaces and newline character. Input must completely match 
>> format.
>
> Just like in scanf, a single space character is sufficient to 
> consume zero or more whitespace characters.
>
> Ali

My mistake. I thought spaces are counted precisely (or maybe it's 
old behavior). But you still should add \n at the end of format 
to avoid format exceptions. That does not make sense for console 
input since every input ended with Enter, which makes newline 
anyway.


More information about the Digitalmars-d-learn mailing list