win32utils-devel@rubyforge.org
2004-Nov-16 05:52 UTC
[Win32utils-devel] Re: Win32, file descriptors and rb_io_check_writable()
Hi,> >Thank you very much Park. There is one curious difference I noticed >with the write operations. It seems that there is a line ending issue >between a file descriptor opened with File.open vs File.nopen. You >can see this easily enough by doing something like this: > >fh1 = File.open("test1.txt","w+") >fh1.print "hello\nworld\n" >fh1.close > >Open this up with notepad - looks fine. Now try this: > >fh2 = File.nopen("test2.txt",nil,nil,File::OPEN_ALWAYS) >fh2.print "hello\nworld\n" >fh2.close > >Opened with notepad, you''ll see that the line endings aren''t the same >(although wordpad handles them properly). I guess I should find an >octal dump tool for windows to verify. Hopefully, you''ll see what I >mean. >Sorry if you receive this message again. My mail account seems to be messed. That is due to detault translation mode. Insert _setmode(NUM2INT(args[0]),_O_TEXT); after RFILE(self)->fptr->mode = rb_io_mode_flags("w+"); RFILE(self)->fptr->f = rb_fdopen(NUM2INT(args[0]),"w+"); in case of TEXT MODE.>Regards, > >DanRegards, Park Heesob --MIME Multi-part separator--