digitalmars.D.learn - readf bug in the std.stdio
- =?ISO-8859-1?Q?Can_Alpay_=c7ift=e7i?= (21/21) Sep 17 2010 Code:
- Ivan Melnychuk (9/17) Sep 30 2010 The strings (char arrays) are handled specially, therefore the [w|d]char...
Code:
import std.stdio;
void main() {
char a;
wchar b;
dchar c;
readf("%s %s %s", &a,&b,&c);
}
Error :
dmd -w -c "isimsiz.d" (C:\Program Files\Geany )
C:\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(441): Error: template
std.format.unformatValue(T,Range,Char) if (isArray!(T) && !isSomeString!(T))
does not match any function template declaration
C:\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(441): Error: template
std.format.unformatValue(T,Range,Char) if (isArray!(T) && !isSomeString!(T))
cannot deduce template function from argument types
!(char)(LockingTextReader,FormatSpec!(char))
C:\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(441): Error: template
instance errors instantiating template
Is that intended, or a bug?
Please note that this works:
int i;
readf("%s", &i);
Sep 17 2010
On 17.09.2010 22:28, Can Alpay Çiftçi wrote:
Code:
import std.stdio;
void main() {
char a;
wchar b;
dchar c;
readf("%s %s %s",&a,&b,&c);
}
The strings (char arrays) are handled specially, therefore the [w|d]char
arrays cannot be read. But are you sure you need to read chars and not
strings (char arrays)? The following will work fine:
...
char[] a;
wchar[] b;
dchar[] c;
...
Sep 30 2010








Ivan Melnychuk <ivan.melnychuk+news gmail.com>