| 5526 |
5526 |
|
| 5527 |
5527 |
/*
|
| 5528 |
5528 |
* call-seq:
|
| 5529 |
|
* File.new(filename, mode="r") => file
|
| 5530 |
|
* File.new(filename [, mode [, perm]]) => file
|
|
5529 |
* File.new(filename, mode="r") => file
|
|
5530 |
* File.new(filename [, mode [, perm]]) => file
|
|
5531 |
* File.open(filename, mode="r") => file
|
|
5532 |
* File.open(filename, mode="r") {|f| block } => obj
|
|
5533 |
* File.open(filename [, mode [, perm]]) => file
|
|
5534 |
* File.open(filename [, mode [, perm]]) {|f| block } => obj
|
| 5531 |
5535 |
*
|
| 5532 |
5536 |
|
| 5533 |
5537 |
* Opens the file named by _filename_ according to
|
| ... | ... | |
| 5540 |
5544 |
* bits are platform dependent; on Unix systems, see
|
| 5541 |
5545 |
* <code>open(2)</code> for details.
|
| 5542 |
5546 |
*
|
|
5547 |
* With no associated block, <code>open</code> is a synonym for
|
|
5548 |
* <code>File::new</code>.
|
|
5549 |
* If the optional code block is given, it will
|
|
5550 |
* be passed <i>f</i> as an argument, and the File object will
|
|
5551 |
* automatically be closed when the block terminates. In this instance,
|
|
5552 |
* <code>File::open</code> returns the value of the block.
|
|
5553 |
*
|
| 5543 |
5554 |
* f = File.new("testfile", "r")
|
| 5544 |
5555 |
* f = File.new("newfile", "w+")
|
| 5545 |
5556 |
* f = File.new("newfile", File::CREAT|File::TRUNC|File::RDWR, 0644)
|