LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-23-2004, 12:42 PM   #1
MadCactus
Member
 
Registered: Jul 2003
Distribution: Slackware 9.1
Posts: 195

Rep: Reputation: 30
Can the C preprocessor do this?


Hi,

I would like, in my C program, using macros, to:

1) Get the full pathnames of various directories in the installation
2) Append filenames to these literals
3) Use them in my program

However I understand that when pasting, macro definitions are not expanded so concatenation is not actually possible with a pre-defined macro as an argument.

Is there then another way to do this?
 
Old 08-23-2004, 10:40 PM   #2
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 43
This sounds like something that should be done in your Makefile or a configure script. Figure out the full path somehow with the shell, and pass it as a simple define with -D
 
Old 08-24-2004, 01:29 AM   #3
cppkid
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Ubuntu
Posts: 185

Rep: Reputation: 30
If you want to do it inside your C++ program you can get the current working directory by getcwd() or if you want to get the path of the directory where your setup file exists, or from where you have launched your program setup you can get it from /proc/self/exe .
If this is not what you want please give a little discription of what you want to do.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
c preprocessor commands & return types(?) kpachopoulos Programming 4 12-06-2005 09:18 AM
Snort BO Preprocessor Vulnerability Capt_Caveman Linux - Security 0 10-19-2005 01:33 AM
No C++ preprocessor Mandrake 10.1 ? TotalDefiance Linux - Software 1 11-04-2004 10:41 PM
C preprocessor error mokojin Slackware 7 11-01-2004 02:56 AM
libmeci50 rejected by the preprocessor! - While compiling BongFish Linux - General 2 06-01-2004 04:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration