There are 19 messages in this thread.
You are currently looking at messages 0 to 10.
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?
"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)
"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.
"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
"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.
"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
"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
"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.
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
"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.