"ab" mode in fopen

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pereges

    "ab" mode in fopen

    Can I use this mode to create a new file , add some data and then
    append more data ? How is it different from ab+ ?
  • Kenneth Brody

    #2
    Re: "ab&quo t; mode in fopen

    [Critical part of question in subject: "ab" mode in fopen]

    pereges wrote:
    >
    Can I use this mode to create a new file , add some data and then
    append more data ?
    Yes.
    How is it different from ab+ ?
    "ab" is "append; open or create binary file for writing at end-of-file"
    and "ab+" is "append; open or create binary file for update, writing at
    end-of-file".

    In other words, the difference is that "ab" is write-only, while "ab+"
    is read/write.

    --
    +-------------------------+--------------------+-----------------------+
    | Kenneth J. Brody | www.hvcomputer.com | #include |
    | kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer .h|
    +-------------------------+--------------------+-----------------------+
    Don't e-mail me at: <mailto:ThisIsA SpamTrap@gmail. com>

    Comment

    • pereges

      #3
      Re: &quot;ab&quo t; mode in fopen

      On Apr 10, 10:18 pm, Kenneth Brody <kenbr...@spamc op.netwrote:
      [Critical part of question in subject: "ab" mode in fopen]
      >
      pereges wrote:
      >
      Can I use this mode to create a new file , add some data and then
      append more data ?
      >
      Yes.
      >
      How is it different from ab+ ?
      >
      "ab" is "append; open or create binary file for writing at end-of-file"
      and "ab+" is "append; open or create binary file for update, writing at
      end-of-file".
      >
      In other words, the difference is that "ab" is write-only, while "ab+"
      is read/write.
      Then in that case, ab+ is better if you want to do write followed by
      read in same function.


      Comment

      • Joachim Schmitz

        #4
        Re: &quot;ab&quo t; mode in fopen

        pereges wrote:
        On Apr 10, 10:18 pm, Kenneth Brody <kenbr...@spamc op.netwrote:
        >[Critical part of question in subject: "ab" mode in fopen]
        >>
        >pereges wrote:
        >>
        >>Can I use this mode to create a new file , add some data and then
        >>append more data ?
        >>
        >Yes.
        >>
        >>How is it different from ab+ ?
        >>
        >"ab" is "append; open or create binary file for writing at
        >end-of-file" and "ab+" is "append; open or create binary file for
        >update, writing at end-of-file".
        >>
        >In other words, the difference is that "ab" is write-only, while
        >"ab+" is read/write.
        >
        Then in that case, ab+ is better if you want to do write followed by
        read in same function.
        replace 'better' with 'correct' 8-)

        Bye, Jojo


        Comment

        Working...