chmod(...)
public
Changes permission bits on the named file(s) to the bit pattern represented
by mode_int. Actual effects are operating system dependent (see
the beginning of this section). On Unix systems, see chmod(2) for
details. Returns the number of files processed.
File.chmod(0644, "testfile", "out")
Show source
/*
* call-seq:
* File.chmod(mode_int, file_name, ... ) -> integer
*
* Changes permission bits on the named file(s) to the bit pattern
* represented by <i>mode_int</i>. Actual effects are operating system
* dependent (see the beginning of this section). On Unix systems, see
* <code>chmod(2)</code> for details. Returns the number of files
* processed.
*
* File.chmod(0644, "testfile", "out") #=> 2
*/
static VALUE
rb_file_s_chmod(argc, argv)
int argc;
VALUE *argv;
{
VALUE vmode;
VALUE rest;
int mode;
long n;
rb_secure(2);
rb_scan_args(argc, argv, "1*", &vmode, &rest);
mode = NUM2INT(vmode);
n = apply2files(chmod_internal, rest, &mode);
return LONG2FIX(n);
}