From: Richard Dawe Newsgroups: comp.os.msdos.djgpp Subject: Re: User login name ? Date: Tue, 18 Jul 2000 20:56:30 +0100 Organization: Customer of Planet Online Lines: 24 Message-ID: <3974B66E.6ACADB13@phekda.freeserve.co.uk> References: <8l28aa$h49$1 AT plato DOT wadham DOT ox DOT ac DOT uk> NNTP-Posting-Host: modem-4.tellurium.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news6.svr.pol.co.uk 963951030 30959 62.136.43.4 (18 Jul 2000 20:10:30 GMT) NNTP-Posting-Date: 18 Jul 2000 20:10:30 GMT X-Complaints-To: abuse AT theplanet DOT net X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.14 i586) X-Accept-Language: de,fr To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello. J-P wrote: > > Piotr Eljasiak wrote: > > How can I get user login name ? getlogin() returns only value of env > > var either $USER or $LOGNAME, and none of these vars is set by the > > Win9x/NT4 system while user logging in. > > The environment variable USERNAME is, I think, set by NT: I don't have > WinXX to hand. If you can access environment variables, you can access > that one. Windows '95 doesn't seem to set this. The information is, however, stored in a registry key, which can be accessed from DOS programs running under Windows. libwin provides functionality to do this - please see: http://www.phekda.freeserve.co.uk/richdawe/mysoft.html#libwin Hope this helps, bye, -- Richard Dawe [ mailto:richdawe AT bigfoot DOT com | http://www.bigfoot.com/~richdawe/ ]