Method: File.truncate
- Defined in:
- file.c
.truncate(file_name, integer) ⇒ 0
5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 |
# File 'file.c', line 5018
static VALUE
rb_file_s_truncate(VALUE klass, VALUE path, VALUE len)
{
struct truncate_arg ta;
int r;
ta.pos = NUM2POS(len);
FilePathValue(path);
path = rb_str_encode_ospath(path);
ta.path = StringValueCStr(path);
r = (int)(VALUE)rb_thread_call_without_gvl(nogvl_truncate, &ta,
RUBY_UBF_IO, NULL);
if (r < 0)
rb_sys_fail_path(path);
return INT2FIX(0);
#undef NUM2POS
}
|