How to write an emoji to stdout in C

1 Answer

0 votes
#include <stdio.h> // stdout // puts
#include <locale.h> // setlocale
#include <stdlib.h> // EXIT_FAILURE
#include <wchar.h> // fputwc
#include <errno.h> // errno

int main(void)
{
    setlocale(LC_ALL, "en_US.utf8");

    errno = 0;
    if (fputwc(L'????', stdout) == WEOF) {
        if (errno == EILSEQ) {
            puts("fputwc() - Encoding Error");
        }
        else {
            puts("fputwc() Error");
        }
            
        return EXIT_FAILURE;
    }
}



/*
run:

????

*/

 



answered Feb 4, 2023 by avibootz
edited Feb 4, 2023 by avibootz

Related questions

1 answer 204 views
2 answers 241 views
241 views asked Jul 14, 2020 by avibootz
1 answer 238 views
1 answer 181 views
...