diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-02-05 19:53:30 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-02-05 19:53:30 +0000 |
| commit | 47d48da4bae33a3fb5f9942bc2d5afeb09e714eb (patch) | |
| tree | 27ddf3af910ff2d61d0bf6d5b6091aed00f413b9 | |
| parent | 5187d24af1657bedc99d7c06be2c4c7824f3993b (diff) | |
Try to implement FileWriter::OpenModify on Windows.
| -rw-r--r-- | asdcplib/src/KM_fileio.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/asdcplib/src/KM_fileio.cpp b/asdcplib/src/KM_fileio.cpp index 138bc3b4..d48e7554 100644 --- a/asdcplib/src/KM_fileio.cpp +++ b/asdcplib/src/KM_fileio.cpp @@ -833,6 +833,34 @@ Kumu::FileWriter::OpenWrite(const char* filename) // Kumu::Result_t +Kumu::FileWriter::OpenModify(const char* filename) +{ + KM_TEST_NULL_STR_L(filename); + m_Filename = filename; + + // suppress popup window on error + UINT prev = ::SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); + + m_Handle = ::CreateFileA(filename, + (GENERIC_WRITE|GENERIC_READ), // open for reading + FILE_SHARE_READ, // share for reading + NULL, // no security + OPEN_ALWAYS, // don't truncate existing + FILE_ATTRIBUTE_NORMAL, // normal file + NULL // no template file + ); + + ::SetErrorMode(prev); + + if ( m_Handle == INVALID_HANDLE_VALUE ) + return Kumu::RESULT_FILEOPEN; + + m_IOVec = new h__iovec; + return Kumu::RESULT_OK; +} + +// +Kumu::Result_t Kumu::FileWriter::Writev(ui32_t* bytes_written) { assert( ! m_IOVec.empty() ); |
