🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.misc
Article #36382

Re: Variable de Ambiente en C

#36382
From: Andres Lopehandia (Panameno)
Date: Tue, 03 Dec 1996 00:00
44 lines
2254 bytes
MARTOQ AHUMADA ALDRIN GONZALO (amartoq@cec.uchile.cl) wrote:
: VALLARINO ESNAOLA CRISTIAN IGNA (cvallari@cec.uchile.cl) wrote:
: : Hola.. 
: : Necesito guardar en un string el valor de una variable de ambiente de UNIX
: : con C. Probe con getenv() pero insiste en tirarme un Segmentation Fault y no
: : he logado saber por que razon?.. alguien tiene alguna pista que me ayude?
: Como la usaste? yo no he tenido problemas con getenv...

: void main()
: { char *palabra
         ^^^^^^^^

   /* pida memoria: */

   palabra=(char*) malloc(sizeof(char)*256);
   if(palabra==NULL) perror("No hay memoria disponible);

:   palabra=getenv("HOME");
:   if (palabra!=NULL)
:   { printf("Tu directorio 'HOME' es:%s",palabra);}
:   else
:   { printf("Variable HOME no existe!");}
:   printf("\nok :)\n");
: }

: atte,

: -- 
:                                                        ..       :
:                     .Aldrin Gonzalo    .               .   .  .
:       .           .          Martoq ahumada        .. .  .  *
:             .                         .   .  .  .   .
: http://araucaria.cec.uchile.cl/~amartoq. . *:. . .
: .                                 .  .   . .. .         .
:              .  .  .    .           mailto: amartoq@cec.uchile.cl
:             .  .. :.    .              .               .



atte


	Andr'es Lopehandia M.
Technical Details
Message-ID: <581ovo$4d3@dcc.uchile.cl>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <57pkgf$jtq@ict.cec.uchile.cl> <57v9mv$nfa@ict.cec.uchile.cl>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII-7-bit
X-Google-Thread: 107d6b,4a2e6b0a59b949ce
X-Google-Attributes: gid107d6b,public
X-Google-Thread: faaa5,4a2e6b0a59b949ce
X-Google-Attributes: gidfaaa5,public
X-Google-Thread: 107515,4a2e6b0a59b949ce
X-Google-Attributes: gid107515,public
X-Google-Thread: 143321,4a2e6b0a59b949ce
X-Google-Attributes: gid143321,public
X-Google-Thread: 116101,4a2e6b0a59b949ce
X-Google-Attributes: gid116101,public
From: alopehan@borg.dcc.uchile.cl (Andres Lopehandia (Panameno))
Subject: Re: Variable de Ambiente en C
Date: 1996/12/03
Message-ID: <581ovo$4d3@dcc.uchile.cl>
X-Deja-AN: 202207371
references: <57pkgf$jtq@ict.cec.uchile.cl> <57v9mv$nfa@ict.cec.uchile.cl>
organization: Universidad de Chile, Depto. de Ciencias de la Computacion
newsgroups: chile.comp.misc,uch.ing.cec,uch.ing.dcc,uch.ing.consultas,chile.consultas