On 2007-11-15 17:17, Wojciech Puchar <[EMAIL PROTECTED]> 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 $ _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"