Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   pl... answer me this question .. urgent (http://www.go4expert.com/forums/pl-answer-question-urgent-t19927/)

vignesh1988i 31Oct2009 09:02

pl... answer me this question .. urgent
 
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:)

SaswatPadhi 31Oct2009 13:19

Re: pl... answer me this question .. urgent
 
Check this : http://www.cplusplus.com/reference/c.../cstdio/fopen/

murugaperumal 26Feb2010 16:26

Re: pl... answer me this question .. urgent
 
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

rekha_sri 27Feb2010 14:59

Re: pl... answer me this question .. urgent
 
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.


All times are GMT +5.5. The time now is 06:30.