nxt.stdio

Backwards-compatible extensions of std.stdio.{f}write{ln} to p{f}write{ln}.

Test: dmd -version=show -preview=dip1000 -preview=in -vcolumns -d -I.. -i -debug -g -checkaction=context -allinst -unittest -main -run stdio.d

Members

Functions

epwrite
void epwrite(Format fmt, Args args)

Pretty-formatted fwrite(stderr, ...).

epwriteln
void epwriteln(Format fmt, Args args)

Pretty-formatted stderr.writeln.

ewrite
void ewrite(Args args)

Alternative to std.stdio.write(stderr).

fpwrite
void fpwrite(FILE* sm, Format fmt, Args args)

Pretty-formatted fwrite(sm, ...).

fpwriteln
void fpwriteln(FILE* sm, Format fmt, Args args)

Pretty-formatted fwriteln.

fwrite
void fwrite(FILE* sm, Args args)

Alternative to std.stdio.fwrite.

fwriteln
void fwriteln(FILE* sm, Args args)

Alternative to std.stdio.fwriteln.

pwriteln
void pwriteln(Format fmt, Args args)

Pretty-formatted writeln.

write
void write(Args args)

Alternative to std.stdio.write(stdout).

writeln
void writeln(Args args)

Alternative to std.stdio.writeln.

Structs

Format
struct Format

Writing/Printing format.

See Also

core.internal.dassert

NOTE: Replacing calls to overloaded fpwrite1 with non-overloaded versions such as fpwrite1_char, fpwrite1_string reduces compilation memory usage.

TODO: Cast to arg const for T being struct and class with const toString to avoid template-bloat

TODO: Use setlocale to enable correct printing {w|d}char([]) #include <wchar.h> #include <locale.h> #include <stdio.h>

int main() { // Set the locale to the user default, which should include Unicode support setlocale(LC_ALL, "");

wchar_t letter1 = L'å'; wchar_t letter2 = L'ä'; wchar_t letter3 = L'ö';

wprintf(L"%lc %lc %lc\n", letter1, letter2, letter3);

return 0; }

In D you use:

import core.stdc.locale : setlocale, LC_ALL; () @trusted { setlocale(LC_ALL, ""); }();

TODO: Perhaps make public (top) functions throw static exceptions keeping them @nogc.

Meta