aboutsummaryrefslogtreecommitdiff
path: root/src/sfile.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-10-31 05:44:33 +0000
committerMike Buland <eichlan@xagasoft.com>2006-10-31 05:44:33 +0000
commitbdd4bdd8615b1587974312a92219cbeab0068a7a (patch)
treec4fd27267755179327673e4fc501740d01ed9b43 /src/sfile.cpp
parenta67fdaa1ef1e3a5eea88d19e327c05330998e8aa (diff)
downloadlibbu++-bdd4bdd8615b1587974312a92219cbeab0068a7a.tar.gz
libbu++-bdd4bdd8615b1587974312a92219cbeab0068a7a.tar.bz2
libbu++-bdd4bdd8615b1587974312a92219cbeab0068a7a.tar.xz
libbu++-bdd4bdd8615b1587974312a92219cbeab0068a7a.zip
Changed the file class to be SFile so that it will collide less, all of them
will be named like that, make life easier.
Diffstat (limited to '')
-rw-r--r--src/sfile.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/sfile.cpp b/src/sfile.cpp
new file mode 100644
index 0000000..9c5f830
--- /dev/null
+++ b/src/sfile.cpp
@@ -0,0 +1,37 @@
1#include "sfile.h"
2#include "exceptions.h"
3
4SFile::SFile( const char *sName, const char *sFlags )
5{
6 fh = fopen( sName, sFlags );
7}
8
9SFile::~SFile()
10{
11}
12
13void SFile::close()
14{
15 if( fh )
16 {
17 fclose( fh );
18 fh = NULL;
19 }
20}
21
22size_t SFile::read( char *pBuf, size_t nBytes )
23{
24 if( !fh )
25 throw FileException("SFile not open.");
26
27 return fread( pBuf, 1, nBytes, fh );
28}
29
30size_t SFile::write( char *pBuf, size_t nBytes )
31{
32 if( !fh )
33 throw FileException("SFile not open.");
34
35 return fwrite( pBuf, 1, nBytes, fh );
36}
37