Forum: FXRuby writing image into a ruby file

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
1623c78b9509240b9290841b5da9d5e9?d=identicon&s=25 Ben G. (bgoh29)
on 2009-11-13 04:46
hi all,

I remember (very) long time ago, there was some information posted about
loading an image into a ruby file. I am trying to look for the sniplet
of the code but couldn't find anytying. Just wondering if anyone could

This is some of the extract of the code:-

#I am trying to write the content of the icon into an include file.

def loadIcon(file)
begin, "rb")  do |f|
      icon =,
      raise RuntimeError, "Couldn't load icon: #{file}"

#I'm trying load 'Australia-Flag.ico' and store it as a constant
 filename = 'c:\FXRUbySample\Australia-Flag.ico'
 icon75 = loadIcon(filename)'c:\FXRubySample\aus.rb', 'wb')'c:\FXRubySample\aus.rb','wb') do |f|
     #puts icon75
     f.syswrite icon75

#none of the puts and syswrite works.
This topic is locked and can not be replied to.