LinuxQuestions.org
Review your favorite Linux distribution.
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 02-23-2004, 03:58 PM   #1
mark_2811
LQ Newbie
 
Registered: Sep 2003
Posts: 24

Rep: Reputation: 15
when to use environment variables?


I'm developing an application (embedded) that needs some configuration setting to be loaded on startup. The way I've usually done this before is a custom formatted configuration file that the applications reads on startup. I'm wondering if using the environment variables would be a better way? When are environment variables preferred over a configuration file?

I'd like most settings to be loaded one time at startup, but also have some settings that can be changed during runtime, without stopping and restarting the application. Is this something that environment variables can help me to do?

Any info is appreciated!

Thanks,
Mark
 
Old 02-23-2004, 05:14 PM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Re: when to use environment variables?

Quote:
Originally posted by mark_2811
I'm wondering if using the environment variables would be a better way?
You can have both for more flexibility, having env var's override options from the config file.
 
Old 02-23-2004, 06:09 PM   #3
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
I like Hko's suggestion. And if you really want to get fancy.... do your config files in XML instead of a custom format. This might be completely overboard for your task however, so take it or leave it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Environment Variables - where do they go!?! iansoundz Linux - General 7 11-17-2005 02:27 AM
environment variables in c++ s3b0 Programming 6 08-27-2004 09:19 AM
environment variables kakridge Linux - Newbie 1 07-14-2003 06:25 PM
environment variables. jISV Linux - General 0 04-05-2002 06:01 AM
environment variables aethereal Linux - Newbie 7 12-19-2001 09:34 AM

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

All times are GMT -5. The time now is 12:44 AM.

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