...
Code Block | ||||
---|---|---|---|---|
| ||||
char *tmpvar; char *tempvar; tmpvar = getenv("TMP"); if (!tmpvar) { return -1; } tempvar = getenv("TEMP"); if (!tempvar) { return -1; } if (strcmp(tmpvar, tempvar) == 0) { if (puts("TMP and TEMP are the same.\n") == EOF) { /* Handle error */ } } else { if (puts("TMP and TEMP are NOT the same.\n") == EOF) { /* Handle error */ } } |
...
Code Block | ||||
---|---|---|---|---|
| ||||
char *tmpvar; char *tempvar; size_t len; errno_t err = _dupenv_s(&tmpvar, &len, "TMP"); if (err) { return -1; } err = _dupenv_s(&tempvar, &len, "TEMP"); if (err) { free(tmpvar); tmpvar = NULL; return -1; } if (strcmp(tmpvar, tempvar) == 0) { if (puts("TMP and TEMP are the same.\n") == EOF) { /* Handle error */ } } else { if (puts("TMP and TEMP are NOT the same.\n") == EOF) { /* Handle error */ } } free(tmpvar); tmpvar = NULL; free(tempvar); tempvar = NULL; |
...