VirtualBox

Changeset 48820 in vbox for trunk/src


Ignore:
Timestamp:
Oct 2, 2013 1:56:36 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
89477
Message:

IPRT/RTFileModeToFlags(Ex): Introduced "oa" mode for opening + appending an existing file.

Location:
trunk/src/VBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox

  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r48803 r48820  
    1074210742            <li><tt>"ca"</tt>: Creates a new file, always. Overwrites an existing file.</li>
    1074310743            <li><tt>"ce"</tt>: Creates a new file if it does not exist. Fail if exist.</li>
     10744            <li><tt>"oa"</tt>: Opens an existing file and places the file pointer at the
     10745              end of the file, if opened with write access. Create the file if it does not exist.</li>
    1074410746            <li><tt>"oc"</tt>: Opens and existing file or create it if it does not exist.</li>
    1074510747            <li><tt>"oe"</tt>: Opens an existing file or fail if it does not exist.</li>
  • trunk/src/VBox/Runtime/common/misc/RTFileModeToFlags.cpp

    r47783 r48820  
    5656        switch (*pszCur)
    5757        {
    58             /* Opens an existing file for reading and places the
    59              * file pointer at the end of the file. */
     58            /* Opens an existing file for writing and places the
     59             * file pointer at the end of the file. The file is
     60             * created if it does not exist. */
    6061            case 'a':
    6162                if ((uMode & RTFILE_O_ACTION_MASK) == 0)
    6263                {
    63                     uMode |=   RTFILE_O_OPEN
    64                              | RTFILE_O_READ
     64                    uMode |=   RTFILE_O_OPEN_CREATE
     65                             | RTFILE_O_WRITE
    6566                             | RTFILE_O_APPEND;
    6667                }
     
    136137                switch (chPrev)
    137138                {
     139                    case 'a':
    138140                    case 'c':
    139141                    case 'w':
     
    143145                        break;
    144146
    145                     case 'a':
    146147                    case 'r':
    147148                        /* Also open / create file with write access. */
     
    216217
    217218    /*
    218      * Handle open mode.
     219     * Handle access mode.
    219220     */
    220221    while (    pszCur
     
    306307    else if (!RTStrCmp(pszCur, "oc"))
    307308        uMode |= RTFILE_O_OPEN_CREATE;
     309    /* Open existing file and place the file pointer at
     310     * the end of the file, if opened with write access.
     311     * Create the file if does not exist. */
     312    else if (!RTStrCmp(pszCur, "oa"))
     313        uMode |= RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND;
    308314    /* Open existing, fail if does not exist. */
    309315    else if (!RTStrCmp(pszCur, "oe"))
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette