Input -> 😂😂
Output-> 😂😂
I simply want to maintain the original state of the emoji.
All i am doing is this
#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;
}
In Unicode encoding, emoji must take more than one bytes. Hence printing byte by byte will not help in this case. If you redirect the output to a file, you may get almost same as your file.
You may try to print the string by changing locale(on Linux) or you can try wprintf on Windows (remember to convert to Wide string).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With