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 148 views
1 answer 117 views
1 answer 127 views
127 views asked Apr 6, 2022 by avibootz
1 answer 137 views
1 answer 140 views
140 views asked Apr 6, 2022 by avibootz
1 answer 112 views
1 answer 121 views
...