From: Michael Davis Date: 2001-09-21T03:10:19+09:00 Subject: [ruby-talk:21450] Low level file I/O question I have created a class in c that fills a buffer with information. I would like to read and write that buffer without having to create a String. File.read() creates and returns a String. For example, I would like to call File.read(buffer, size) and have my buffer filled directly with information. I would like to find the best way call fread/fwrite directly using my buffer and have the file still be compatible with IO.read and IO.write from other Ruby IO methods. Any suggestions on the best way to do this? I am considering writing my own version of IO.read and IO.write call IO.read_direct(buffer, size) and IO.write_direct(buffer, size). What are the risks with me calling fread/fwrite directly? What are the risks if I later call IO.read and IO.write against the same file pointer? Has anyone done anything similar? How can I pass a buffer pointer (declared as a char * in my buffer class) to these functions in Ruby? Thanks in advance, Michael