#738: A character string cannot be taken out of the variable made by Pointer.new('c'). ----------------------------------+----------------------------------------- Reporter: watson1...@… | Owner: lsansone...@… Type: defect | Status: closed Priority: blocker | Milestone: Component: MacRuby | Resolution: invalid Keywords: | ----------------------------------+-----------------------------------------
Comment(by watson1...@…): Thank you for your comment! It modified the program as follows. {{{ cat test_js.rb framework "JavaScriptCore" string = JSStringCreateWithUTF8CString("hello") size = JSStringGetMaximumUTF8CStringSize(string) buffer = Pointer.new('c', size) ret = JSStringGetUTF8CString(string, buffer, size) ary = [] (ret - 1).times do |i| ary << buffer[i] end puts ary.pack('c*') }}} {{{ $ macruby test_js.rb hello }}} I thought that I should be able to take the character from "buffer" because I made it by Pointer.new('c'). -- Ticket URL: <http://www.macruby.org/trac/ticket/738#comment:2> MacRuby <http://macruby.org/> _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel