D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4822 - Problem with std.stdio.File.writef("%c"
Summary: Problem with std.stdio.File.writef("%c"
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2010-09-05 11:19 UTC by bearophile_hugs
Modified: 2012-04-22 17:48 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2010-09-05 11:19:51 UTC
I think this is a correct D2 program:


import std.stdio: File;
void main() {
    auto f = File("test.txt", "w");
    f.writef("%c", 'x');
}


But DMD dmd 2.048 gives at runtime:
std.format.FormatError: std.format integral
Comment 1 Lars T. Kyllingstad 2011-02-03 00:50:11 UTC
According to the std.format documentation, "%c" is not a valid format specifier.  The error message could be improved, though.
Comment 2 SomeDude 2012-04-21 15:37:32 UTC
The program runs fine on 2.059, and the text file is created with 'x' inside.
Comment 3 Kenji Hara 2012-04-22 17:48:15 UTC
"%c" format specifier has been supported from 2.058:
http://dlang.org/phobos/std_format

It was fixed by the pull request:
https://github.com/D-Programming-Language/phobos/pull/298