Date: Thu, 15 Nov 2007 19:36:23 +0200 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl> Cc: freebsd-questions@freebsd.org Subject: Re: OT: gcc/binutils question Message-ID: <20071115173623.GA1749@kobe.laptop> In-Reply-To: <20071115171510.D59698@wojtek.tensor.gdynia.pl> References: <20071115171510.D59698@wojtek.tensor.gdynia.pl>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2007-11-15 17:17, Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl> wrote: > how to convert arbitrary data (in file) to object file, so i will be able > to do > > extern char something[] > > and use it - in C. Try to file2c(1) utility. Quoting from its manpage: % EXAMPLES % The command: % % date | file2c 'const char date[] = {' ',0};' % % will produce: % % const char date[] = { % 83,97,116,32,74,97,110,32,50,56,32,49,54,58,50,56,58,48,53, % 32,80,83,84,32,49,57,57,53,10 % ,0}; > i did wrote converter that converts data from file to > > const char something[]={firstbyte,secondbyte,.....}; > > and then cc to compile it. > > and it's VERY SLOW when data are few megs - while it's no work in fact. I think there's something wrong with the converter, then. The file2c(1) utility converts my kernel (6 MB of data) in less than 3 seconds: $ /usr/bin/time file2c 'const char kernel[] = {' '};' \ < /boot/kernel/kernel > /dev/null 2.98 real 2.92 user 0.11 sys $
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071115173623.GA1749>