How to use wsprintf to convert int to wchar_t in C

1 Answer

0 votes
#include <stdio.h>
#include <wchar.h>

int main () {
    wchar_t buf[16];
    int n = 8392, len = sizeof(buf) / sizeof(*buf);

    swprintf(buf, 16, L"%d", n);

    wprintf(L"%ls", buf);

    return(0);
}




/*
run:

8392

*/

 



answered Jun 19, 2021 by avibootz

Related questions

1 answer 101 views
1 answer 150 views
150 views asked Feb 11, 2023 by avibootz
3 answers 179 views
179 views asked Apr 7, 2022 by avibootz
1 answer 88 views
88 views asked Oct 10, 2024 by avibootz
1 answer 93 views
1 answer 133 views
133 views asked Aug 15, 2022 by avibootz
4 answers 253 views
253 views asked May 15, 2024 by avibootz
...