aboutsummaryrefslogtreecommitdiff
path: root/src/old/sfile.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-04-03 05:09:12 +0000
committerMike Buland <eichlan@xagasoft.com>2007-04-03 05:09:12 +0000
commitc884da672645231b5ec47706c886381dab1b391a (patch)
treef9c0a0c4fb9006c2c1aa10c8c65de2f6e42894de /src/old/sfile.cpp
parentda89e6d30e57bd6dbb10b4d36b093ce9bbf5c666 (diff)
downloadlibbu++-c884da672645231b5ec47706c886381dab1b391a.tar.gz
libbu++-c884da672645231b5ec47706c886381dab1b391a.tar.bz2
libbu++-c884da672645231b5ec47706c886381dab1b391a.tar.xz
libbu++-c884da672645231b5ec47706c886381dab1b391a.zip
The file stream is imported and works, as does our first test, and the new
tweaks to archive. The && operator is now a template function, and as such requires no special handling. It could be worth it to check this out for other types, yet dangerous, since it would let you archive anything, even a class, without writing the proper functions for it...we shall see what happens...
Diffstat (limited to 'src/old/sfile.cpp')
-rw-r--r--src/old/sfile.cpp74
1 files changed, 0 insertions, 74 deletions
diff --git a/src/old/sfile.cpp b/src/old/sfile.cpp
deleted file mode 100644
index f1de03c..0000000
--- a/src/old/sfile.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
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("File not open.");
26
27 return fread( pBuf, 1, nBytes, fh );
28}
29
30size_t SFile::write( const char *pBuf, size_t nBytes )
31{
32 if( !fh )
33 throw FileException("File not open.");
34
35 return fwrite( pBuf, 1, nBytes, fh );
36}
37
38long SFile::tell()
39{
40 if( !fh )
41 throw FileException("File not open.");
42
43 return ftell( fh );
44}
45
46void SFile::seek( long offset )
47{
48 if( !fh )
49 throw FileException("File not open.");
50
51 fseek( fh, offset, SEEK_CUR );
52}
53
54void SFile::setPos( long pos )
55{
56 if( !fh )
57 throw FileException("File not open.");
58
59 fseek( fh, pos, SEEK_SET );
60}
61
62void SFile::setPosEnd( long pos )
63{
64 if( !fh )
65 throw FileException("File not open.");
66
67 fseek( fh, pos, SEEK_END );
68}
69
70bool SFile::isEOS()
71{
72 return feof( fh );
73}
74