Results 1 to 4 of 4

Thread: Achieve Scalability in Program

  1. #1
    Expert Member
    Join Date
    May 2006
    Answers
    114

    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?


  2. #2
    Contributing Member
    Join Date
    Jul 2006
    Answers
    52

    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.


  3. #3
    Expert Member
    Join Date
    Sep 2006
    Answers
    477

    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!"

  4. #4
    Expert Member
    Join Date
    May 2006
    Answers
    114

    Re: Achieve Scalability in Program

    Thanks for your input. BUt could you tell me how should I declare the variable as an environment variable.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact