|
open(file[, mode])
open(file[, mode]){...}
Opens the file, and returns a File object associated with the file. The mode argument specifies the mode for the opened file, which is either "r", "r+", "w", "w+", "a", "a+". See fopen(3). If mode omitted, the default is "r"
If the file begins with "|", ruby performs following string as a sub-process, and associates pipes to the standard input/output of the sub-process.
Note for the converts from perl: The command string starts with '|', not ends with '|'.
If the command name described above is "-", ruby forks, and create pipe-line to the child process.
When open is called with the block, it opens the file and evaluates the block, then after the evaluation, the file is closed for sure. That is:
open(path, mode) do |f|
...
end
# mostly same as above
f = open(path, mode)
begin
...
ensure
f.close
end
Add by Pancho
You can edit it here
|
|
Adding comments is available only for registered users.
|
Birth of a Hurricane
Summer storms are a regular feature in the North Atlantic, and while most pose little threat to our shores, a choice few become devastating hurricanes. To decipher which storms could bring danger, and which will not, atmospheric scientists are heading to the tropics to observe these systems as they form and dissipate--or develop into hurricanes. By learning to identify which weather systems are the most critical to track, the efforts may ultimately allow for earlier hurricane ...
More at http://www.nsf.gov/news/news_summ.jsp?cntn_id=117388&WT.mc_id=USNSF_51&WT.mc_ev=click
This is an NSF News item.
|
|
PycckaR BepcuR
Articles

Library

Downloads

|