...
Code Block | ||
---|---|---|
| ||
char copy[16];
const char *temp = getenv("TEST_ENV");
if (temp != NULL) {
strcpy(copy, temp);
}
|
...
Code Block | ||
---|---|---|
| ||
char *copy = NULL;
const char *temp = getenv("TEST_ENV");
if (temp != NULL) {
copy = (char *)malloc(strlen(temp) + 1);
if (copy != NULL) {
strcpy(copy, temp);
}
else {
/* handle error condition */
}
}
|
...