![]()
Parent Directory
|
Revision Log
Moved vx32/vxa trees into correct locations
#!/usr/bin/perl
#
# Copyright 2005 Bryan Ford
# Distributed under the GNU General Public License.
#
# Usage: bin2c <name>
#
# This script reads an arbitrary binary file from standard input
# and writes it to standard output as a global array in C source code,
# so that the binary file can be linked into a program as static data.
# The array has the name <name>.
#
if ($#ARGV != 0) {
die "Usage: bin2c <name>";
}
print "unsigned char $ARGV[0]_data[] = {\n";
$len = 0;
while (($n = read STDIN, $str, 10) > 0) {
print "\t";
foreach $i (0 .. $n-1) {
print ord(substr($str, $i, 1)), ", ";
}
print "\n";
$len += $n;
}
print "};\n";
print "const int $ARGV[0]_length = $len;\n";
| Maintained by PDOS | ViewVC Help |
| Powered by ViewVC 1.0.3 |