X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fapi%2Finternal%2Fio%2FBamFile_p.cpp;h=990d9bf3d8797c0c9ad4c85e0791f22fa7711534;hb=e4cb7afa9b8774b4db39db1c60607460676419d3;hp=94c919e944c84406e0f6080f42301faed5ce7473;hpb=90432a3736392f98803a5e8787f3db0dc5bb44ad;p=bamtools.git diff --git a/src/api/internal/io/BamFile_p.cpp b/src/api/internal/io/BamFile_p.cpp index 94c919e..990d9bf 100644 --- a/src/api/internal/io/BamFile_p.cpp +++ b/src/api/internal/io/BamFile_p.cpp @@ -2,7 +2,7 @@ // BamFile_p.cpp (c) 2011 Derek Barnett // Marth Lab, Department of Biology, Boston College // --------------------------------------------------------------------------- -// Last modified: 25 October 2011 (DB) +// Last modified: 10 November 2011 (DB) // --------------------------------------------------------------------------- // Provides BAM file-specific IO behavior // *************************************************************************** @@ -43,6 +43,8 @@ bool BamFile::Open(const IBamIODevice::OpenMode mode) { m_stream = fopen(m_filename.c_str(), "rb"); else if ( mode == IBamIODevice::WriteOnly ) m_stream = fopen(m_filename.c_str(), "wb"); + else if ( mode == IBamIODevice::ReadWrite ) + m_stream = fopen(m_filename.c_str(), "w+b"); else { SetErrorString("BamFile::Open", "unknown open mode requested"); return false; @@ -61,7 +63,7 @@ bool BamFile::Open(const IBamIODevice::OpenMode mode) { return true; } -bool BamFile::Seek(const int64_t& position) { +bool BamFile::Seek(const int64_t& position, const int origin) { BT_ASSERT_X( m_stream, "BamFile::Seek() - null stream" ); - return ( fseek64(m_stream, position, SEEK_SET) == 0 ); + return ( fseek64(m_stream, position, origin) == 0 ); }