aboutsummaryrefslogtreecommitdiff
path: root/src/sfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sfile.cpp')
-rw-r--r--src/sfile.cpp38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/sfile.cpp b/src/sfile.cpp
index 9c5f830..3f5144d 100644
--- a/src/sfile.cpp
+++ b/src/sfile.cpp
@@ -22,16 +22,48 @@ void SFile::close()
22size_t SFile::read( char *pBuf, size_t nBytes ) 22size_t SFile::read( char *pBuf, size_t nBytes )
23{ 23{
24 if( !fh ) 24 if( !fh )
25 throw FileException("SFile not open."); 25 throw FileException("File not open.");
26 26
27 return fread( pBuf, 1, nBytes, fh ); 27 return fread( pBuf, 1, nBytes, fh );
28} 28}
29 29
30size_t SFile::write( char *pBuf, size_t nBytes ) 30size_t SFile::write( const char *pBuf, size_t nBytes )
31{ 31{
32 if( !fh ) 32 if( !fh )
33 throw FileException("SFile not open."); 33 throw FileException("File not open.");
34 34
35 return fwrite( pBuf, 1, nBytes, fh ); 35 return fwrite( pBuf, 1, nBytes, fh );
36} 36}
37 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