www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - getgrgid() for Posix

reply useo6 <nomail dontknowmymail.com> writes:
Hi everyone,

does anyone know how I can the name of a group in Posix? In C/C++ I can use
getgrgid(), but I just found nothing like this function. Is there any
alternative
to get the name of a group of a file?

Thanks in advance!
May 08 2012
parent reply mta`chrono <chrono mta-international.net> writes:
Am 08.05.2012 18:26, schrieb useo6:
 Hi everyone,
 
 does anyone know how I can the name of a group in Posix? In C/C++ I can use
 getgrgid(), but I just found nothing like this function. Is there any
alternative
 to get the name of a group of a file?
 
 Thanks in advance!
Yes that true, it's neither in phobos nor in druntime. Why not using the C Method? Just declare it as extern(C) and use it ;-).
May 08 2012
parent Justin Whear <justin economicmodeling.com> writes:
On Tue, 08 May 2012 18:45:29 +0200, mta`chrono wrote:

 Am 08.05.2012 18:26, schrieb useo6:
 Hi everyone,
 
 does anyone know how I can the name of a group in Posix? In C/C++ I can
 use getgrgid(), but I just found nothing like this function. Is there
 any alternative to get the name of a group of a file?
 
 Thanks in advance!
Yes that true, it's neither in phobos nor in druntime. Why not using the C Method? Just declare it as extern(C) and use it ;-).
I too searched and failed to find it. stat_t (defined in core.sys.posix.stat.d) has a st_gid field which you could use, but simply defining with extern(C) seems to be a better idea.
May 08 2012