Mercurial > hg > octave-shane
changeset 9953:225bfa546ae7
allow + at end of fopen modestrings like rb+
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 10 Dec 2009 01:12:41 -0500 |
parents | 7cd2e1b372e5 |
children | de6b6173c990 |
files | src/ChangeLog src/file-io.cc |
diffstat | 2 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-12-10 John W. Eaton <jwe@octave.org> + + * file-io.cc (fopen_mode_to_ios_mode): Allow "+" at the end of + modestrings like "rb+". + 2009-12-10 John W. Eaton <jwe@octave.org> * oct-stream.cc (BEGIN_C_CONVERSION, BEGIN_S_CONVERSION):
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -184,11 +184,11 @@ retval = std::ios::out | std::ios::trunc; else if (mode == "at") retval = std::ios::out | std::ios::app; - else if (mode == "r+t") + else if (mode == "r+t" || mode == "rt+") retval = std::ios::in | std::ios::out; - else if (mode == "w+t") + else if (mode == "w+t" || mode == "wt+") retval = std::ios::in | std::ios::out | std::ios::trunc; - else if (mode == "a+t") + else if (mode == "a+t" || mode == "at+") retval = std::ios::in | std::ios::out | std::ios::app; else if (mode == "rb" || mode == "r") retval = std::ios::in | std::ios::binary; @@ -196,12 +196,12 @@ retval = std::ios::out | std::ios::trunc | std::ios::binary; else if (mode == "ab" || mode == "a") retval = std::ios::out | std::ios::app | std::ios::binary; - else if (mode == "r+b" || mode == "r+") + else if (mode == "r+b" || mode == "rb+" || mode == "r+") retval = std::ios::in | std::ios::out | std::ios::binary; - else if (mode == "w+b" || mode == "w+") + else if (mode == "w+b" || mode == "wb+" || mode == "w+") retval = (std::ios::in | std::ios::out | std::ios::trunc | std::ios::binary); - else if (mode == "a+b" || mode == "a+") + else if (mode == "a+b" || mode == "ab+" || mode == "a+") retval = (std::ios::in | std::ios::out | std::ios::app | std::ios::binary); else