From: "Wayne E. Seguin" Date: 2007-09-12T10:25:11+09:00 Subject: Re: File#file_descriptor --Apple-Mail-5-799710641 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Sep 11, 2007, at 17:26 , Joel VanderWerf wrote: > Wayne E. Seguin wrote: >> Hopefully someone knows this... I've googled for a while. >> When writing a C extension, how does one access the file >> descriptor of a File object from the C code? > > Take a look at this method in io.c: > > static VALUE > rb_io_fileno(io) > VALUE io; > { > OpenFile *fptr; > int fd; > > GetOpenFile(io, fptr); > fd = fileno(fptr->f); > return INT2FIX(fd); > } Joel, Awesome, this is exactly what I was looking for! Thank you! ~Wayne s///g Wayne E. Seguin Sr. Systems Architect & Systems Administrator --Apple-Mail-5-799710641--