Thread View: pl.comp.lang.c
4 messages
4 total messages
Started by Borneq
Wed, 18 May 2016 10:27
Jak znaleźć katalog użytkownika pod Windows?
Author: Borneq
Date: Wed, 18 May 2016 10:27
Date: Wed, 18 May 2016 10:27
10 lines
1072 bytes
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?
Author: keiichi
Date: Wed, 18 May 2016 14:25
Date: Wed, 18 May 2016 14:25
17 lines
1403 bytes
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?
Author: Wiktor S.
Date: Thu, 19 May 2016 20:35
Date: Thu, 19 May 2016 20:35
15 lines
1155 bytes
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?
Author: Wiktor S.
Date: Thu, 19 May 2016 20:35
Date: Thu, 19 May 2016 20:35
5 lines
1005 bytes
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