std.cstream - D Programming Language - Digital Mars

D Programming Language 2.0

- Comments
- D
- Search
- Home

Last update Wed Sep 2 00:11:53 2009

# std.cstream

The std.cstream module bridges std.c.stdio (or std.stdio) and std.stream. Both std.c.stdio and std.stream are publicly imported by std.cstream.

Authors:
Ben Hinkle

License:
Public Domain

class CFile: std.stream.Stream;
  A Stream wrapper for a C file of type FILE*.

  this(shared(_iobuf)* cfile, FileMode mode, bool seekable = false);
    Create the stream wrapper for the given C file.

    Parameters:

    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.

  shared(_iobuf)* file();
  void file(shared(_iobuf)* 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 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 © 1999-2009 by Digital Mars, All Rights Reserved | Page generated by Ddoc.