open file mode

The file open modes are not really specific to ruby – they are part of IEEE Std 1003.1 (Single UNIX Specification). You can read more about it here:http://pubs.opengroup.org/onlinepubs/009695399/functions/fopen.html

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.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s