www.digitalmars.com [Home] [Search] [D]
Last update Apr 21, 2005

Phobos: std.cstream

The std.cstream module bridges std.c.stdio (or std.stdio) and std.stream. Both std.c.stdio and std.stream are publically imported by std.cstream.
class CFile : Stream
A Stream wrapper for a C file of type FILE*.

this(FILE* file, FileMode mode, bool seekable = false)
Create the stream wrapper for the given C file. The mode parameter is a bitwise combination of FileMode.In for a readable file and FileMode.Out for a writeable file. The seekable parameter indicates if the stream should be seekable.

~this()
Closes the stream

FILE* file
Property to get or sets the underlying file for this stream. Setting the file marks the stream as open.

void flush()
void close()
size_t readBlock(void* buffer, size_t size)
size_t writeBlock(void* buffer, size_t size)
ulong seek(long offset, SeekPos rel)
char getc()
char ungetc(char c)
bool eof()
void writeLine(char[] s)
void writeLineW(wchar[] s)
Overrides of the Stream methods to call the underlying FILE* C functions.
CFile din
CFile wrapper of std.c.stdio.stdin (not seekable).
CFile dout
CFile wrapper of std.c.stdio.stdout (not seekable).
CFile derr
CFile wrapper of std.c.stdio.stderr (not seekable).

Copyright (c) 2004-2005 by Digital Mars, All Rights Reserved