From: jf Baillon Date: 2013-06-26T02:12:47+09:00 Subject: Re: Ruby on Windows - Ouput char Fixnum on console Heesob Park wrote in post #1113488: > Hi, > > 2013/6/25 jf Baillon : >> ======================== >> print "test 200 \n" >> put_cc 108.to_int >> >> Hello Ruby >> >> Attachments: >> http://www.ruby-forum.com/attachment/8534/Ouput_char_Fixnum_on_console.rtf >> > The win32-api gem is not compatible with Ruby 2.0.0. > If you want to use win32-api with Ruby 2.0.0, please make an issue on > https://github.com/djberg96/win32-api/issues > > I recommend ffi instead of win32-api. > You can do the same thing with ffi like this: > ========================================== > require 'ffi' > > module MyLib > extend FFI::Library > ffi_lib FFI::Platform::LIBC > attach_function :_putch, [ :int ], :int > end > > def put_cc car > MyLib._putch(car) > end > > 'hola'.each_byte { |i| put_cc i } > ============================================ > > Regards, > Park Heesob - - - - Your help is providential. Input one character with the keyboard and output on a console now works well with FFI instead of win32/api. I can do elementary word completion (like with an i-phone I have heard). Using the keyboard and the mouse is the beginning of interactivity using a computer and a language. Processing (the computer language) shows using the mouse (or drawing a square) can be (very) easy. I shall try to use Ruby and something like Processing simultaneously. Yet another elementary thing to do : working with two programs. No help from MS Windows system. But I have some ideas. I hope I shall understand better how to use FFI than the last time I had difficulties to resolve some problem. It seems to me there is much more information on FFI today. Users of Mac are smart, users of Linux are intelligent. Add that some authors of programs or tools are esoteric (I should say elegant, but it's easy to understand when you know what it means). I wish there is a place to help ordinary (I don't like "dummy") users with MS Windows. (They could be numerous). Thank you very much. -- Posted via http://www.ruby-forum.com/.