How to use strncpy_s (strncpy) in windows with C

1 Answer

0 votes
#include <windows.h>
#include <string.h>
#include <stdio.h>

int main(void)
{
    char s[64] = "c windows programming";
    char dest[16];
    
    strncpy_s(dest, _countof(dest), s, 9);

    printf("%s\n", dest);

    char ch = getchar();

    return 0;
}
 



/*
run:

c windows

*/

 



answered Apr 5, 2022 by avibootz
edited Apr 6, 2022 by avibootz

Related questions

2 answers 364 views
1 answer 283 views
1 answer 303 views
303 views asked Apr 6, 2022 by avibootz
1 answer 310 views
1 answer 339 views
339 views asked Apr 6, 2022 by avibootz
1 answer 268 views
1 answer 295 views
...