Applies to: DMD 2.060
System: Windows XP SP3
sscanf %n incorrectly works after reading last character.
Code:
import std.stdio, std.string;
alias toStringz z;
void main()
{
int n;
sscanf("a".z, "a%n".z, &n);
assert(n==1); // fail
}
Comment #1 by andrei — 2016-10-15T17:22:27Z
The call sscanf("a".z, "a%n".z, &n); is invalid.
Comment #2 by andrei — 2016-10-15T17:24:43Z
Ah, my bad, it's sscanf not scanf. Tried it just now with dpaste, works.
Comment #3 by andrei — 2016-10-15T17:25:16Z
Wait, the bug is reported on Windows, not Posix. Reopening...
Comment #4 by robert.schadek — 2024-12-07T13:32:09Z