http://bugs.winehq.org/show_bug.cgi?id=13091
--- Comment #13 from Jeff Zaroyko jeffz@jeffz.name 2008-11-13 05:26:05 --- Created an attachment (id=17257) --> (http://bugs.winehq.org/attachment.cgi?id=17257) related problem
ok -- ignoring the silly practice of mixing scanf and gets in the original report, at a glance there does appear to be a related issue with the %d format specifier
It consumes a trailing whitespace character incorrectly, so given the following related testcase[1], input the number 1 followed by enter, on windows it converts the 1 and stores it at &i then converts the newline and stores it at &c.
Under Wine, %d eats both a 1 and the newline and continues reading input attempting the %c conversion. Attached is my suggested fix.
[1]: #include <stdio.h> int main(void) { int i,ret; char c; printf("press the number 1 then hit enter\n"); ret = scanf("%d%c",&i,&c); if(ret == 2) { printf("expecting 1 10: got :%d %d\n"); } return 0; }