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 131 views
1 answer 106 views
1 answer 112 views
112 views asked Apr 6, 2022 by avibootz
1 answer 119 views
1 answer 122 views
122 views asked Apr 6, 2022 by avibootz
1 answer 94 views
1 answer 105 views
...