]>
git.saurik.com Git - wxWidgets.git/blob - src/common/fstream.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: "File stream" classes
4 // Author: Julian Smart
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "fstream.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
19 #include <wx/stream.h>
20 #include <wx/fstream.h>
26 #define BUF_TEMP_SIZE 10000
28 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
32 wxFileInputStream::wxFileInputStream(const wxString
& fileName
)
33 : wxFile(fileName
, read
)
38 wxFileInputStream::~wxFileInputStream()
42 wxInputStream
& wxFileInputStream::Read(void *buffer
, size_t size
)
44 m_lastread
= wxFile::Read(buffer
, size
);
48 off_t
wxFileInputStream::SeekI(off_t pos
, wxSeekMode mode
)
50 return wxFile::Seek(pos
, mode
);
53 off_t
wxFileInputStream::TellI() const
55 return wxFile::Tell();
58 // ----------------------------------------------------------------------------
60 // ----------------------------------------------------------------------------
62 wxFileOutputStream::wxFileOutputStream(const wxString
& fileName
)
63 : wxFile(fileName
, write
)
68 wxFileOutputStream::~wxFileOutputStream()
72 wxOutputStream
& wxFileOutputStream::Write(const void *buffer
, size_t size
)
74 m_lastwrite
= wxFile::Write(buffer
, size
);
75 m_bad
= wxFile::Error();
79 off_t
wxFileOutputStream::TellO() const
81 return wxFile::Tell();
84 off_t
wxFileOutputStream::SeekO(off_t pos
, wxSeekMode mode
)
86 return wxFile::Seek(pos
, mode
);
89 void wxFileOutputStream::Sync()
94 // ----------------------------------------------------------------------------
96 // ----------------------------------------------------------------------------
98 wxFileStream::wxFileStream(const wxString
& fileName
)
99 : wxFile(fileName
, read_write
)
103 wxFileStream::~wxFileStream()