- FileOutputStream(const char* name)
- {
- m_file = name[0] == '\0' ? 0 : fopen(name, "wb");
- }
- ~FileOutputStream()
- {
- if(!failed())
- fclose(m_file);
- }
-
- bool failed() const
- {
- return m_file == 0;
- }
-
- size_type write(const byte_type* buffer, size_type length)
- {
- return fwrite(buffer, 1, length, m_file);
- }
-
- size_type seek(size_type position)
- {
- return fseek(m_file, static_cast<long>(position), SEEK_SET);
- }
- size_type seek(offset_type offset, seekdir direction)
- {
- return fseek(m_file, offset, FileStreamDetail::whence_for_seekdir(direction));
- }
- size_type tell() const
- {
- return ftell(m_file);
- }
+FileOutputStream( const char* name ){
+ m_file = name[0] == '\0' ? 0 : fopen( name, "wb" );
+}
+~FileOutputStream(){
+ if ( !failed() ) {
+ fclose( m_file );
+ }
+}
+
+bool failed() const {
+ return m_file == 0;
+}
+
+size_type write( const byte_type* buffer, size_type length ){
+ return fwrite( buffer, 1, length, m_file );
+}
+
+size_type seek( size_type position ){
+ return fseek( m_file, static_cast<long>( position ), SEEK_SET );
+}
+size_type seek( offset_type offset, seekdir direction ){
+ return fseek( m_file, offset, FileStreamDetail::whence_for_seekdir( direction ) );
+}
+size_type tell() const {
+ return ftell( m_file );
+}