Computing.Net > Forums > Programming > c++ - path question

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

c++ - path question

Reply to Message Icon

Name: BabaG
Date: May 26, 2008 at 23:48:29 Pacific
OS: mandriva 2007.1
CPU/Ram: p4
Product: self
Comment:

is there a way to return the current a account in c++?
i'm thinking of how to return something like "/home/babag."

i have a small app that i need to run on more than one box.
once in the account, the paths will be pretty much the
same on each. i'm thinking that if i can return the account
home path, i can store it in one variable and store the
rest of the path in ampther and put the two together to
form the path for the current box.

for example, each box might be in variable1, while a common
part of the path might be in variable2.

variable1 = /home/_this_account;
variable2 = "/path_to_app";

thanks,
BabaG



Sponsored Link
Ads by Google

Response Number 1
Name: klint
Date: May 27, 2008 at 03:41:15 Pacific
Reply:

You can get the home directory from the environment table (getenv) but there is an easier way: use the character "~" which is shorthand for the home directory. For example, "~/path/to/app".


0
Reply to Message Icon

Related Posts

See More


Batch File: error with pi... batch: trim string error



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: c++ - path question

c++ string manipulation question www.computing.net/answers/programming/c-string-manipulation-question/11524.html

VS C++ Question www.computing.net/answers/programming/vs-c-question/9652.html

C code question www.computing.net/answers/programming/c-code-question/4464.html