Creates a new name for an existing file
using a hard link. Will not overwrite
new_name if it already exists (raising a subclass of SystemCallError). Not available on all
platforms.
File.link("testfile",".testfile")#=> 0IO.readlines(".testfile")[0]#=> "This is line one\n"
static VALUE
rb_file_s_link(VALUE klass, VALUE from, VALUE to)
{
rb_secure(2);
FilePathValue(from);
FilePathValue(to);
from = rb_str_encode_ospath(from);
to = rb_str_encode_ospath(to);
if (link(StringValueCStr(from), StringValueCStr(to)) < 0) {
sys_fail2(from, to);
}
return INT2FIX(0);
}