pl... answer me this question .. urgent

Discussion in 'C' started by vignesh1988i, Oct 31, 2009.

  1. vignesh1988i

    vignesh1988i Banned

    Joined:
    Sep 19, 2009
    Messages:
    72
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Chennai
    file handling in C , consists of an important mode called "rb" , "wb" , "r+b" , "w+b" ... actually what does it mean... :)

    plz... help me out:)
     
  2. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~

    Joined:
    May 5, 2009
    Messages:
    1,342
    Likes Received:
    55
    Trophy Points:
    0
    Occupation:
    STUDENT !
    Location:
    Orissa, INDIA
    Home Page:
    http://www.crackingforfun.blogspot.com
  3. murugaperumal

    murugaperumal New Member

    Joined:
    Feb 20, 2010
    Messages:
    15
    Likes Received:
    1
    Trophy Points:
    0
    Dear Friend,

    I have explained the mode which is used in the fopen function.

    r or rb
    Open file for reading.
    w or wb
    Truncate to zero length or create file for writing.
    a or ab
    Append; open or create file for writing at end-of-file.
    r+ or rb+ or r+b
    Open file for update (reading and writing).
    w+ or wb+ or w+b
    Truncate to zero length or create file for update.
    a+ or ab+ or a+b
    Append; open or create file for update, writing at end-of-file.

    open or createThe character 'b' shall have no effect, but is allowed for ISO C standard conformance
     
  4. rekha_sri

    rekha_sri New Member

    Joined:
    Feb 20, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    Following explanations for fopen() function different modes.

    rb Open a binary file for reading. The file which is specified in the
    fopen() must be exist. wb Create an empty binary file for writing. If the file exists, file contents will be cleared unless it is a logical file. ab Open a binary file in append mode for writing at the end of the file. If file is doesn't exist fopen() function will create the file. r+b or rb+ Open a binary file for both reading and writing. The file must be exist. w+b or wb+ Create an empty binary file for both reading and writing. If the file exists, file contents will be cleared unless it is a logical file. a+b or ab+ Open a binary file in append mode for writing at the end of the file. If file is does not exist fopen() function will create the file.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice