Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on Achieve Scalability in Program within the C and C++ forums, part of the Software Development category; I have a file stored in some location and I want to use this file some other C program. If I give the path of the file hard coded in ...
|
|||||||
|
|||
|
Achieve Scalability in Program
I have a file stored in some location and I want to use this file some other C program. If I give the path of the file hard coded in the program then later on if I move the file to some other location then again I have to change the path of the file in the program. But instead I want to make the program recognize the file path even if I change the file location somewhere. How to achieve the same?
|
| Sponsored Links |
|
|||
|
Re: Achieve Scalability in Program
You can define the filename in a global variable and then use the variable in the program.If the file name changes only the global variable gets changed.This is one of the option for achieving the desired result of yours.
|
|
|||
|
Re: Achieve Scalability in Program
You can declare the variable as an environment variable. (ENV variable of the ENV in which you are running the code. May be DOS, WINDOWS or UNIX). Place all the files which are read to be read by your code in this location. You can move the files to whichever location you want and just change the ENV variable to point to that location
Advantage of using ENV variable is, not only one package but many packages/applications can use this variable.
__________________
[COLOR="Blue"][SIZE="2"]"If you are not living on the edge of your life, you are wasting space"[/SIZE][/COLOR] Someone says "Impossible is nothing". The man next him says "Let me see you licking your elbow tip!" |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ways to Achieve Query Optimization | joel | SQL | 2 | 02-07-2007 02:19 PM |