root/lang/c/AutoUpdater/trunk/recipes/carray.rb @ 37985

Revision 37977, 467 bytes (checked in by saturday06, 4 years ago)

sort

  • Property svn:executable set to *
Line 
1
2system("upx --ultra-brute #{ARGV[0]}")
3
4file = open(ARGV[1], "rb")
5
6print "const char #{ARGV[0]}_DATA[] = {\n"
7
8while true
9  print "X("
10  20.times do |n|
11    unless n == 0
12      print ","
13    end
14    r = file.read(1)
15    if r
16      char = r[0]
17    else
18      char = 0
19    end
20    print sprintf("%02x", char)
21  end
22  print ")\n"
23  if file.eof?
24    break
25  end
26end
27
28print "0};\n"
29
30print "const size_t #{ARGV[0]}_BYTES = #{file.pos};\n"
31
Note: See TracBrowser for help on using the browser.