home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_08_11
/
8n11032a
< prev
next >
Wrap
Text File
|
1990-09-18
|
653b
|
37 lines
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main()
{
char *pc;
char ev[] = "test=1234";
if (putenv(ev) == -1)
printf("cannot define string\n");
else {
printf("string definition added\n");
pc = getenv("test");
printf("string defined as >%s<\n", pc);
ev[6] = 'x';
pc = getenv("test");
printf("string defined as >%s<\n", pc);
strcpy(ev, "xyz");
pc = getenv("test");
if (pc == NULL)
printf("no such string\n");
else
printf("string defined as >%s<\n", pc);
system("see");
}
}
string definition added
string defined as >1234<
string defined as >1x34<
no such string