alxlabs
August 21st, 2008, 06:06 PM
For the console app I used something like this
if ((lgn = getlogin()) == NULL || (pw = getpwnam(lgn)) == NULL)
ALog->append("Get of user information failed.");
else
{
sprintf (tempbuf, "Working folder: %s", pw->pw_dir);
ALog->append(tempbuf);
}
For some reason it does not work for graphic application if started from the shortcut on the desktop (or any other way without a console) - getlogin returns NULL... Any idea how to make it work or do it any other way?
if ((lgn = getlogin()) == NULL || (pw = getpwnam(lgn)) == NULL)
ALog->append("Get of user information failed.");
else
{
sprintf (tempbuf, "Working folder: %s", pw->pw_dir);
ALog->append(tempbuf);
}
For some reason it does not work for graphic application if started from the shortcut on the desktop (or any other way without a console) - getlogin returns NULL... Any idea how to make it work or do it any other way?