🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

4 total messages Started by Borneq Wed, 18 May 2016 10:27
Jak znaleźć katalog użytkownika pod Windows?
#308568
Author: Borneq
Date: Wed, 18 May 2016 10:27
10 lines
1072 bytes
np.c:\Users\Andrzej\
pod Linuxem jest to

#include <pwd.h>
#include <unistd.h>

struct passwd *pw = getpwuid(getuid());
string homedir = pw->pw_dir;

Ale chcę napisać program działający tu i tu.
Re: Jak znaleźć katalog użytkownika pod Windows?
#308569
Author: keiichi
Date: Wed, 18 May 2016 14:25
17 lines
1403 bytes
W dniu 2016-05-18 o 12:27, Borneq pisze:
> np.c:\Users\Andrzej\
> pod Linuxem jest to
>
> #include <pwd.h>
> #include <unistd.h>
>
> struct passwd *pw = getpwuid(getuid());
> string homedir = pw->pw_dir;
>
> Ale chcę napisać program działający tu i tu.

#if albo użyj jakiejś warstwy abstrakcji (boost, Qt, itp.), np.:

boost::filesystem::current_path()

Pozdrawiam
Re: Jak znaleźć katalog użytkownika pod Windows?
#308572
Author: Wiktor S.
Date: Thu, 19 May 2016 20:35
15 lines
1155 bytes
> Ale chcę napisać program działający tu i tu.


string homedir;

#ifdef UNIX
  homedir = getenv("USERPROFILE");
#else
  struct passwd *pw = getpwuid(getuid());
  homedir = pw->pw_dir;
#endif


-- 
Wiktor S.
Re: Jak znaleźć katalog użytkownika pod Windows?
#308573
Author: Wiktor S.
Date: Thu, 19 May 2016 20:35
5 lines
1005 bytes
Tfu, odwrotnie ;-)


-- 
Wiktor S.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads