Read the text file with emoji and print it

Login β†’ πŸ˜‚πŸ˜‚

Exit-> ≑ƒÿé≑ƒÿé

I just want to keep the initial state of emoji.

All i do is

#include <stdio.h> #include <stdlib.h> int main() { char ch; FILE *fp; fp = fopen("test.txt","r"); while( ( ch = fgetc(fp) ) != EOF ) printf("%c",ch); fclose(fp); return 0; } 
+5
source share
1 answer

Unicode encoded emoji must accept more than one byte. Therefore, byte by byte in this case will not help. If you redirect the output to a file, you can get almost the same file as your file.

You can try to print the string by changing the language (on Linux), or you can try wprintf on Windows (don't forget to convert to Wide string).

+1
source

Source: https://habr.com/ru/post/1209804/


All Articles