Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 02-23-2004, 03:58 PM   #1
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!

Old 02-23-2004, 05:14 PM   #2
Senior Member
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

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

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
Senior Member
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 66
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.


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

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

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