ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I'm writing a C program, and using Autotools. I have a large text file that I need to include verbatim, as data for my program.
I used to have a hacked-together Perl script that would take a file like this:
A Rabbi, a Priest, and a Minister walked into a bar.
The bartender said, "What is this, a joke?"
and generate a file like this:
#define TXT_DATA \
"A Rabbi, a Priest, and a Minister walked into a bar.\n" \
"The bartender said, \"What is this, a joke?\"\n" \
which I would then include into every source file that needed it. Unfortunately, I managed to somehow lose my Perl script, and rather than recreate it, I wanted to learn how to do this The Right Way(tm).
I found this site that contains instructions for doing exactly what I want, but that technique requires GNU's ld, and the whole point of using Autotools in the first place is to make my project platform- and compiler-independent.
Anybody got any ideas?
Edit: I should point out that, according to the Autotools help, I can do this with a script called either "txtc.sh" or "txtc.sh.in". Unfortunately, Google can't find such a script, and it's not in any package that I can find.
Last edited by Hidden Windshield; 08-26-2010 at 11:05 PM.
Yes, the text has to be embedded in the executable. Also, cat wouldn't work, since it would also need to escape quotes, add quotes to every line, add a backslash to the end of every line, etc., etc., etc.
For the moment (so the project can go ahead), I'm going to recreate my Perl script. However, I would really like to know if there's any way to do this.
Edit: Something like a Windows resource, for those of you familiar with Windows programming.
Last edited by Hidden Windshield; 08-27-2010 at 02:04 PM.