delorie.com/archives/browse.cgi | search |
From: | "Piotr Eljasiak" <eljasiak AT NO-SPAM DOT zt DOT gdansk DOT tpsa DOT pl> |
Newsgroups: | comp.os.msdos.djgpp |
References: | <bw1d5.17053$pD2 DOT 338143 AT news DOT tpnet DOT pl> <8l28aa$h49$1 AT plato DOT wadham DOT ox DOT ac DOT uk> |
Subject: | Odp: User login name ? |
Lines: | 27 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.00.2417.2000 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2314.1300 |
Message-ID: | <oK4d5.17772$pD2.355373@news.tpnet.pl> |
Date: | Tue, 18 Jul 2000 22:20:04 GMT |
NNTP-Posting-Host: | 213.76.28.41 |
X-Complaints-To: | abuse AT tpsa DOT pl |
X-Trace: | news.tpnet.pl 963958804 213.76.28.41 (Wed, 19 Jul 2000 00:20:04 MET DST) |
NNTP-Posting-Date: | Wed, 19 Jul 2000 00:20:04 MET DST |
Organization: | TPNET - http://www.tpnet.pl |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
> 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. You're right, but I don't think this solution is very portable - IMHO better way is to modify getlogin(), let's say: char * getlogin(void) { char *p; p = getenv("USER"); if (!p) p = getenv("LOGNAME"); if (!p) p = getenv("USERNAME"); if (!p) p = default_login; return p; } This way it'll work under NT, but what about WinXX ? Piotr Eljasiak
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |