diff --git a/include/kabufuda/Card.hpp b/include/kabufuda/Card.hpp index 12afea6..ad9ef59 100644 --- a/include/kabufuda/Card.hpp +++ b/include/kabufuda/Card.hpp @@ -524,6 +524,11 @@ public: */ void close(); + /** + * @brief Access host filename of card + */ + const SystemString& cardFilename() const { return m_filename; } + /** * @brief Gets card-scope error state * @return READY, BROKEN, or NOCARD diff --git a/lib/kabufuda/Card.cpp b/lib/kabufuda/Card.cpp index 780168c..a151f91 100644 --- a/lib/kabufuda/Card.cpp +++ b/lib/kabufuda/Card.cpp @@ -117,7 +117,7 @@ Card::Card(const SystemString& filename, const char* game, const char* maker) : /* Close and reopen in read/write mode */ fclose(m_fileHandle); - m_fileHandle = Fopen(m_filename.c_str(), _S("r+")); + m_fileHandle = Fopen(m_filename.c_str(), _S("r+b")); rewind(m_fileHandle); } } @@ -949,7 +949,7 @@ void Card::format(ECardSlot id, ECardSize size, EEncoding encoding) memset(data.get(), 0xFF, dataLen); fwrite(data.get(), 1, dataLen, m_fileHandle); fclose(m_fileHandle); - m_fileHandle = Fopen(m_filename.c_str(), _S("r+")); + m_fileHandle = Fopen(m_filename.c_str(), _S("r+b")); } }