...
Code Block | ||
---|---|---|
| ||
char ntbs[NTBS_SIZE];
strncpy(ntbs, source, sizeof(ntbs)-1);
ntbs[sizeof(ntbs)-1] = '\0';
|
...
Code Block | ||
---|---|---|
| ||
char *source; char a[NTBS_SIZE]; /* ... */ if (source) { errno_t err = strncpy_s(a, sizeof(a), source, 5); if (err != 0) { /* handleHandle error */ } } else { /* handle NULL string condition */ } |
...