How can I print (☞ ゚ ヮ ゚) ☞ using Ncurses?

I would like to print the (☞ ゚ ヮ ゚) ☞ Ncurses library using C ++ on Ubuntu.

First of all, you can do this simply by having:

std::cout << "(☞゚ヮ゚)☞" << std::endl;

And it works great.

However, when printing using Ncurses, I find that you need to use printw(char[]). In this case, I try something like this:

std::string str = "(☞゚ヮ゚)☞";   // String
initscr();                     // Start curses mode
printw(str.c_str());           // Print
getch();                       // Wait for input
endwin();                      // Exit curses mode

But he deduces:

(~ X ~ ^ ~~ C ~) ~ X ~ ^

I thought it might have been a mistake c_str(), but when I do this with help std::cout, that is fine too.

How to print this text with Ncurses? Why does it work with std::cout, and not with, Ncurses' printw(char[])?

I compile with

g++ Main.cpp -lncurses

On a 64-bit machine. Ubuntu (also 64 bit) runs on VirtualBox with OSX as the host.


Update

qaru.site/questions/669393/.... , , - , :

(- ~ ~ ^ -OM- > ~ - ~ -.M-OM- > ~) - ~ ~ ^

+3
1

, . , Ubuntu, -, Unicode.

sudo apt-get install libncursesw5-dev

#include <iostream>
#include <string>
#include "locale.h"
#include "ncursesw/ncurses.h"
using namespace std;

int main()
{
    setlocale(LC_ALL, "");
    std::string str = "(☞゚ヮ゚)☞";   // String
    initscr();                     // Start curses mode
    printw(str.c_str());           // Print
    getch();                       // Wait for input
    endwin();  
    return 0;
}

.

#include "ncursesw/ncurses.h"

+2

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


All Articles