Sign in

username:

password:



Not a member?

Search Comp.Arch.Embedded



Search tips

embedded by Keywords

68HC11 | 68HC12 | 8051 | 8052 | ARM | ARM7 | Asic | AT91 | AT91RM9200 | Atmel | AVR | AVRStudio | Bootloader | CFP | CompactFlash | Cygnal | Cypress | Dataflash | DSP | eCos | EEPROM | Embedded Linux | Emulator | Endian | Ethernet | Firewire | FPGA | Freescale | GCC | GNUARM | GSM | H8 | HDLC | I2C | Infineon | Interrupts | Java | JTAG | LCD | LED | LPC2000 | MCU | Microchip | MMC | MPLAB | MSP430 | PC104 | PCB | PCI | PCMCIA | PowerPC | Rabbit | RS232 | RS485 | RTOS | SBC | SDRAM | Sensor | SPI | STK500 | UART | UML | USART | USB | Verilog | VHDL | VxWorks | Xilinx

Ads

Discussion Groups

Discussion Groups | Comp.Arch.Embedded | Converting filesystem to ".C" prog file

There are 19 messages in this thread.

You are currently looking at messages 0 to 10.

Converting filesystem to ".C" prog file - Fred - 08:08 01-11-05

I need to convert a number of files which contain data to a C program file.

I have come across a perl script which is meant to do this.  However it 
doesn't work with perl in the recent version of Cygwin.

Does anyone have anything which can help or point me in the right direction? 





Re: Converting filesystem to ".C" prog file - Frank Bemelman - 08:28 01-11-05

"Fred" <f...@nowhere.com> schreef in bericht
news:436768d7$0$23280$d...@news.zen.co.uk...
> I need to convert a number of files which contain data to a C program
file.
>
> I have come across a perl script which is meant to do this.  However it
> doesn't work with perl in the recent version of Cygwin.
>
> Does anyone have anything which can help or point me in the right
direction?

Well, fix it or write something quick & dirty in C then.

-- 
Thanks, Frank.
(remove 'q' and '.invalid' when replying by email)



Re: Converting filesystem to ".C" prog file - Fred - 08:53 01-11-05

"Frank Bemelman" <f...@xs4all.invalid.nl> wrote in message 
news:43676d50$0$11098$e...@dreader16.news.xs4all.nl...
> "Fred" <f...@nowhere.com> schreef in bericht
> news:436768d7$0$23280$d...@news.zen.co.uk...
>> I need to convert a number of files which contain data to a C program
> file.
>>
>> I have come across a perl script which is meant to do this.  However it
>> doesn't work with perl in the recent version of Cygwin.
>>
>> Does anyone have anything which can help or point me in the right
> direction?
>
> Well, fix it or write something quick & dirty in C then.
>
> -- 

Yes thanks.  I would like to fix it but I have abysmal knowledge of perl.

There seems little sense in reinventing wheels. 



Re: Converting filesystem to ".C" prog file - Scott Seidman - 09:20 01-11-05

"Fred" <f...@nowhere.com> wrote in
news:43677368$0$23288$d...@news.zen.co.uk: 

> 
> "Frank Bemelman" <f...@xs4all.invalid.nl> wrote in message 
> news:43676d50$0$11098$e...@dreader16.news.xs4all.nl...
>> "Fred" <f...@nowhere.com> schreef in bericht
>> news:436768d7$0$23280$d...@news.zen.co.uk...
>>> I need to convert a number of files which contain data to a C
>>> program 
>> file.
>>>
>>> I have come across a perl script which is meant to do this.  However
>>> it doesn't work with perl in the recent version of Cygwin.
>>>
>>> Does anyone have anything which can help or point me in the right
>> direction?
>>
>> Well, fix it or write something quick & dirty in C then.
>>
>> -- 
> 
> Yes thanks.  I would like to fix it but I have abysmal knowledge of
> perl. 
> 
> There seems little sense in reinventing wheels. 
> 
> 
> 

We'd like to help, but you've provided exactly zero useful data to help
us help you.  "Convert data files to C program" can mean absolutely
anything (and I'd be a little surprised if you can find some generic
script which will do exactly what you need it to do).  "Doesn't work
with Cygwin" is even less useful.  Is it running?  Is it simply not
producing the output you want?  Are you getting an error message?  Is it
not finding your input file because of a path problem?  I find perl to
be very portable between distributions, so I'd be a more surprised if
the code weren't doing exactly what it was written to do, as opposed to
being written to do something other than what you need it to do. 

You'll find that until you can provide well-formed questions, you'll be
reinventing wheels quite a bit. 

As for pointing you in the right direction, try
http://www.oreilly.com/catalog/learnperl4/ and
http://www.oreilly.com/catalog/lperlwin/ 

My estimate is that if you've done any programming in any language,
you'll be able to fix your perl script in a week, if you spend about 25%
of your time on it, or 2-3 days at 100%.  You might get lucky, and fix
the problem in an hour or two.  Because of the nature of perl code, my
bet is it will take you about the same amount of time to write your
converter from scratch as it will to decipher someone else's code. 
 
-- 
Scott
Reverse name to reply

Re: Converting filesystem to ".C" prog file - Fred - 09:52 01-11-05

"Scott Seidman" <n...@mindspring.com> wrote in message 
news:Xns97015EEF8E10Escottseidmanmindspri@130.133.1.4...

<snip>
>
> We'd like to help, but you've provided exactly zero useful data to help
> us help you.  "Convert data files to C program" can mean absolutely
> anything (and I'd be a little surprised if you can find some generic
> script which will do exactly what you need it to do).

OK, I accept the criticism.  I agree I can write my own code in C to convert 
html files into const char data for use with am embedded server.  I was 
hoping for an open sourced solution which would go either the full or part 
way into creating this C code.  I could then compile and link this with the 
rest of the webserver.

Thanks for the links of books on the subject but I don't think with the 
learning curve of perl it's an ideal approach.




Re: Converting filesystem to ".C" prog file - Thomas Gellekum - 10:25 01-11-05

"Fred" <f...@nowhere.com> writes:

> I agree I can write my own code in C to convert 
> html files into const char data for use with am embedded server.

I'm still not sure if that's what you want, but you might want to
look for file2c(1):

,----
| 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};
`----

tg

Re: Converting filesystem to ".C" prog file - Steve at fivetrees - 12:11 01-11-05

"Fred" <f...@nowhere.com> wrote in message 
news:4367813b$0$23282$d...@news.zen.co.uk...
>
> "Scott Seidman" <n...@mindspring.com> wrote in message 
> news:Xns97015EEF8E10Escottseidmanmindspri@130.133.1.4...
>
> <snip>
>>
>> We'd like to help, but you've provided exactly zero useful data to help
>> us help you.  "Convert data files to C program" can mean absolutely
>> anything (and I'd be a little surprised if you can find some generic
>> script which will do exactly what you need it to do).
>
> OK, I accept the criticism.  I agree I can write my own code in C to 
> convert html files into const char data for use with am embedded server. 
> I was hoping for an open sourced solution which would go either the full 
> or part way into creating this C code.  I could then compile and link this 
> with the rest of the webserver.

Does your webserver have PHP? If so, it's quite easy to write a PHP script 
to produce C data. (I've done so many times). However you still haven't told 
us what kind of data you're trying to convert (other than it's HTML).

Steve
http://www.fivetrees.com 



Re: Converting filesystem to ".C" prog file - Fred - 14:21 01-11-05

"Steve at fivetrees" <s...@NOSPAMTAfivetrees.com> wrote in message 
news:4...@pipex.net...
> "Fred" <f...@nowhere.com> wrote in message 
> news:4367813b$0$23282$d...@news.zen.co.uk...
>>
>> "Scott Seidman" <n...@mindspring.com> wrote in message 
>> news:Xns97015EEF8E10Escottseidmanmindspri@130.133.1.4...
>>
>> <snip>
>>>
>>> We'd like to help, but you've provided exactly zero useful data to help
>>> us help you.  "Convert data files to C program" can mean absolutely
>>> anything (and I'd be a little surprised if you can find some generic
>>> script which will do exactly what you need it to do).
>>
>> OK, I accept the criticism.  I agree I can write my own code in C to 
>> convert html files into const char data for use with am embedded server. 
>> I was hoping for an open sourced solution which would go either the full 
>> or part way into creating this C code.  I could then compile and link 
>> this with the rest of the webserver.
>
> Does your webserver have PHP? If so, it's quite easy to write a PHP script 
> to produce C data. (I've done so many times). However you still haven't 
> told us what kind of data you're trying to convert (other than it's HTML).
>
> Steve
> http://www.fivetrees.com

I haven't come across PHP.  I'm trying to put together a very basic webpage 
which crudely gives the status of a system.  The HTML is very basic!

I was hoping for a windows program which converted a filename into a const 
char name and the contents into hex data. Similar to the "file2c" pipe in an 
earlier post.

As intimated earlier, it would be fairly quick for me to write my own.

Many thanks.



Re: Converting filesystem to ".C" prog file - =?iso-8859-1?q?Michael_Kr=E4mer?= - 07:02 02-11-05

Fred wrote:
> I need to convert a number of files which contain data to a C program file.
>
> I have come across a perl script which is meant to do this.  However it
> doesn't work with perl in the recent version of Cygwin.
>
> Does anyone have anything which can help or point me in the right direction?

If a windows program is acceptable for you, then try this one:
http://www.qsl.net/dk8pp/downloads/bin2c.zip

I wrote it for the purpose of embedding binary data (.png, .mp3, .wav
and the like) into an embedded C-project. The zip-file contains the
source and the project for the Open Watcom compiler. The program can
convert individual files or  a list of files. If multiple files are
converted, then a "table of contents" can be created. Just play around
and you will see how it works. Feel free to adapt the program to your
requirements.

Michael


Re: Converting filesystem to ".C" prog file - Fred - 10:20 02-11-05

"Michael Krämer" <m...@yahoo.com> wrote in message 
news:1...@g14g2000cwa.googlegroups.com...
> Fred wrote:
>> I need to convert a number of files which contain data to a C program 
>> file.
>>
>> I have come across a perl script which is meant to do this.  However it
>> doesn't work with perl in the recent version of Cygwin.
>>
>> Does anyone have anything which can help or point me in the right 
>> direction?
>
> If a windows program is acceptable for you, then try this one:
> http://www.qsl.net/dk8pp/downloads/bin2c.zip
>
> I wrote it for the purpose of embedding binary data (.png, .mp3, .wav
> and the like) into an embedded C-project. The zip-file contains the
> source and the project for the Open Watcom compiler. The program can
> convert individual files or  a list of files. If multiple files are
> converted, then a "table of contents" can be created. Just play around
> and you will see how it works. Feel free to adapt the program to your
> requirements.
>
> Michael
>

That's immensely kind of you.  I don't know C++ but the files convert very 
nicely.  I will try a bit of tinkering.  I see you can select multiple 
source files and that you used Watcom. 



| 1 | 2 | next