🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #17137

Re: obtener $HOME en c

#17137
From: J.A. Gutierrez
Date: Thu, 17 Feb 2000 00:00
28 lines
1625 bytes
Ignacio Arenaza <inaki.arenaza@jet.es> wrote:
: -----BEGIN PGP SIGNED MESSAGE-----
: Hash: SHA1

:>>>>> "amphora" ==   <amphora@portatil.es> writes:

:     amphora> Hola.  Pues eso,hay alguna funcion que me permita leer la
:     amphora> variable $HOME del usuario que ejecuta un programa que
:     amphora> estoy haciendo.

: man getenv(3)

: Lo bueno si breve...

	la respuesta es correcta, pero apostaria a que la pregunta no.

	Si la pregunta es "como obtener el home de un usuario, que no
	tiene por que coincidir con la variable HOME", la respuesta es
	
	pwd = getpwuid ( getuid () )
	home = pwd->pw_dir;


-- 
PGP and other useless info at      \                      Oh, show us the way
http://www.cps.unizar.es/~spd/      \                  to the next whisky bar
finger://daphne.cps.unizar.es/spd    \                           Weill/Bretch
es doloroso ser sabio y descubrir la sopa de ajo                        (Pla)
Technical Details
Message-ID: <88gojt$8v1$2@news.unizar.es>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <slrn8ajt0o.bc.amphora@portatil.es> <873dqs51u4.fsf@eb2ebu.ampr.org>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII-7-bit
X-Google-Thread: f86c8,9caa0ae392836b03
X-Google-Attributes: gidf86c8,public
From: "J.A. Gutierrez" <spd@daphne.cps.unizar.es>
Subject: Re: obtener $HOME en c
Date: 2000/02/17
Message-ID: <88gojt$8v1$2@news.unizar.es>
X-Deja-AN: 586895863
References: <slrn8ajt0o.bc.amphora@portatil.es> <873dqs51u4.fsf@eb2ebu.ampr.org>
X-Complaints-To: usenet@news.unizar.es
X-Trace: news.unizar.es 950789565 9185 155.210.152.20 (17 Feb 2000 12:12:45 GMT)
Organization: Rank
User-Agent: tin/1.4.1-19991201 ("Polish") (UNIX) (IRIX/6.2 (IP22))
NNTP-Posting-Date: 17 Feb 2000 12:12:45 GMT
Newsgroups: es.comp.os.linux.programacion