class Poco::FileStream

Overview

A stream for reading from and writing to a file. More…

#include <FileStream.h>

class FileStream:
    public Poco::FileIOS,
    public iostream
{
public:
    // construction

    FileStream();

    FileStream(
        const std::string& path,
        std::ios::openmode mode = std::ios::out|std::ios::in
        );
};

Inherited Members

public:
    // methods

    void
    open(
        const std::string& path,
        std::ios::openmode mode
        );

    void
    close();

    FileStreamBuf*
    rdbuf();

protected:
    // fields

    FileStreamBuf _buf;
    std::ios::openmode _defaultMode;

Detailed Documentation

A stream for reading from and writing to a file.

Files are always opened in binary mode, a text mode with CR-LF translation is not supported. Thus, the file is always opened as if the std::ios::binary flag was specified. Use an InputLineEndingConverter or OutputLineEndingConverter if you require CR-LF translation.

A seek (seekg() or seekp()) operation will always set the read position and the write position simultaneously to the same value.

On Windows platforms, if POCO_WIN32_UTF8 is #define’d, UTF-8 encoded Unicode paths are correctly handled.

Construction

FileStream()

Creats an unopened FileStream.

FileStream(
    const std::string& path,
    std::ios::openmode mode = std::ios::out|std::ios::in
    )

Creates the FileStream for the file given by path, using the given mode.