help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: generating a user-specific string


From: Qianqian Fang
Subject: Re: generating a user-specific string
Date: Tue, 27 Apr 2010 19:29:47 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9pre) Gecko/20100209 Shredder/3.0.2pre

On 04/27/2010 06:40 PM, Judd Storrs wrote:
On Tue, Apr 27, 2010 at 5:15 PM, Qianqian Fang<address@hidden>  wrote:
I don't know if it is possible for octave to return me a
unique string for each user, so, everyone will be able to
save to its own folder across multiple sessions.
tempname is not preferred as it changes everytime,
which presumably will leave a lot of folders under /tmp.
Since you want the path to be the same across sessions, you could
build the path explicitly off of the username. getenv("USER") will
give you the username as a string and you can concatenate that to
build a directory path. Maybe something like:

usertmpdir = [P_tmpdir filesep "session-" getenv("USER")]

thank you and Søren for the quick response, I did
a little bit search and managed to code something
similar to you both suggested:

 username=getenv('USER'); % for Linux/Unix/Mac OS
 if(isempty(username))
    username=getenv('UserName'); % for windows
 end
 if(~isempty(username))
    username=['session-' username];
 end

getenv('UserName') enables this for windows machines.

Qianqian



--judd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]