Geeks Talk

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.

Achieve Scalability in Program

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 ...

Go Back   Geeks Talk > Software Development > C and C++
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 06-24-2006
Expert Member
 
Join Date: May 2006
Location: New York, USA
Posts: 118
Thanks: 0
Thanked 6 Times in 4 Posts
RyanJames is on a distinguished road
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?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-12-2006
Contributing Member
 
Join Date: Jul 2006
Posts: 52
Thanks: 0
Thanked 2 Times in 2 Posts
Bessie is on a distinguished road
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.
Reply With Quote
  #3 (permalink)  
Old 12-11-2006
Expert Member
 
Join Date: Sep 2006
Location: Bengalooru (Formerly called Bangalore), India
Posts: 486
Thanks: 2
Thanked 29 Times in 28 Posts
kalayama is on a distinguished road
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!"
Reply With Quote
  #4 (permalink)  
Old 12-15-2006
Expert Member
 
Join Date: May 2006
Location: New York, USA
Posts: 118
Thanks: 0
Thanked 6 Times in 4 Posts
RyanJames is on a distinguished road
Re: Achieve Scalability in Program

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

  Geeks Talk > Software Development > C and C++

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Ways to Achieve Query Optimization joel SQL 2 02-07-2007 02:19 PM


All times are GMT -4. The time now is 09:46 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved