Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

std.cstream

Warning: This module is considered out-dated and not up to Phobos' current standards. It will remain until we have a suitable replacement, but be aware that it will not remain long term.
The std.cstream module bridges core.stdc.stdio (or std.stdio) and std.stream. Both core.stdc.stdio and std.stream are publicly imported by std.cstream.
License:
Authors:
Ben Hinkle

Source: std/cstream.d

class CFile: std.stream.Stream;
A Stream wrapper for a C file of type FILE*.
this(FILE* cfile, FileMode mode, bool seekable = false);
Create the stream wrapper for the given C file.
Parameters:
FILE* cfile a valid C FILE pointer to wrap.
FileMode mode a bitwise combination of FileMode.In for a readable file and FileMode.Out for a writeable file.
bool seekable indicates if the stream should be seekable.
@property FILE* file();
@property void file(FILE* cfile);
Property to get or set the underlying file for this stream. Setting the file marks the stream as open.
void flush();
void close();
bool eof();
char getc();
char ungetc(char c);
size_t readBlock(void* buffer, size_t size);
size_t writeBlock(const void* buffer, size_t size);
ulong seek(long offset, SeekPos rel);
void writeLine(const(char)[] s);
void writeLineW(const(wchar)[] s);
Overrides of the Stream methods to call the underlying FILE* C functions.
CFile din;
CFile wrapper of core.stdc.stdio.stdin (not seekable).
CFile dout;
CFile wrapper of core.stdc.stdio.stdout (not seekable).
CFile derr;
CFile wrapper of core.stdc.stdio.stderr (not seekable).