ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I can get the following (png) displaying under the console.
WHY DEBIAN REMOVED cp850-8x16.psf.gz from stable?? Some anti-DOS? Under the console, it works (table ascii with codepage) and ACS VLINE/HLINE,... are correct!!!
-----------------------
(2) UNDER X11 : I would like that someone help how to make cp850 working on XTERM?
not working
What a very pitty misery that Linux cannot change the codepage properly and ncurses to follow up as well. This is a big lack of compatibility.
anyone knowing how to use ACS_D_VLINE or ACS_D_HLINE?
Sorry that I do not understand what you are doing, nor can offer a solution.
But I can say that mc (same idea) works in xterm with a current kernel and Xorg and Terminus font, so it certainly does work. Take that as encouragement to figure out what you may be doing incorrectly.
I found NCURSES_WIDECHAR in the header file. http://invisible-island.net/ncurses/...dd_wch.3x.html mentions the widechar equivalent to mvaddch(), mvadd_wch(). Also, the setlocale() call is needed else you get the default characters mentioned on that page which don't look very good.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <unistd.h>
#include <wchar.h>
#define NCURSES_WIDECHAR 1 /* defining _XOPEN_SOURCE >= 500 also works */
#include <ncursesw/ncurses.h>
// Compile with:
// gcc -Wall -Wextra -Wformat=2 -ggdb -pedantic -std=c99 box.c -lncursesw -o box
int main()
{
setlocale(LC_ALL, "");
initscr();
mvprintw(0,0, "Hello World !!!");
mvprintw(4,0, "Simple Lines:");
mvadd_wch( 5, 5, WACS_VLINE );
mvadd_wch( 7, 5, WACS_HLINE );
mvprintw(9,0, "Double Lines:");
mvadd_wch( 10, 5, WACS_D_VLINE );
mvadd_wch( 11, 5, WACS_D_HLINE );
refresh(); /* Print it on to the real screen */
getch(); /* Wait for user input */
endwin(); /* End curses mode */
return 0;
}
I found NCURSES_WIDECHAR in the header file. http://invisible-island.net/ncurses/...dd_wch.3x.html mentions the widechar equivalent to mvaddch(), mvadd_wch(). Also, the setlocale() call is needed else you get the default characters mentioned on that page which don't look very good.
thank you for your interests in wide ACS of ncursesw.
In the above example, I have tried to compile but visibly sthg wrong.
Code:
gcc -Wall -Wextra -Wformat=2 -ggdb -pedantic -std=c99 test.c -lncursesw -o test
test.c: In function ‘main’:
test.c:54:5: warning: implicit declaration of function ‘mvadd_wch’ [-Wimplicit-function-declaration]
test.c:58:23: error: ‘WACS_D_VLINE’ undeclared (first use in this function)
test.c:58:23: note: each undeclared identifier is reported only once for each function it appears in
test.c:59:23: error: ‘WACS_D_HLINE’ undeclared (first use in this function)
I have this current code:
Code:
#include <string.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <curses.h>
#include <locale.h>
#include <unistd.h>
#include <math.h>
const wchar_t
VRT = L'\x2551', // ║
HRZ2 = L'\x2550', // ═
HRZ1 = L'\x2500', // ─
TUP = L'\x2569';
int col, row ;
typedef long long int64;
// Compile with:
// gcc -Wall -Wextra -Wformat=2 -ggdb -pedantic -std=c99 test.c -lncursesw -o test
int main()
{
setlocale(LC_ALL, "");
initscr();
mvprintw(0,0, "Hello World !!!");
mvprintw(4,0, "Simple Lines:");
mvadd_wch( 5, 5, ACS_VLINE );
mvadd_wch( 7, 5, ACS_HLINE );
mvprintw(9,0, "Double Lines: ║");
mvadd_wch( 10, 5, WACS_D_VLINE );
mvadd_wch( 11, 5, WACS_D_HLINE );
refresh(); /* Print it on to the real screen */
getch(); /* Wait for user input */
endwin(); /* End curses mode */
return 0;
}
In this following version of the code, I try not to use the WACS_D_... since it is not defined into pdcursesw. I would like that my code with double lines, works either on linux and windows.
Code:
#include <string.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <curses.h>
#include <locale.h>
#include <unistd.h>
#include <math.h>
//gcc -Wall -Wextra -Wformat=2 -ggdb -pedantic -std=c99 test.c -lncursesw -o run
const wchar_t
VRT = L'\x2551', // ║
HRZ2 = L'\x2550', // ═
HRZ1 = L'\x2500', // ─
TUP = L'\x2569';
int col, row ;
typedef long long int64;
// Compile with:
// gcc -Wall -Wextra -Wformat=2 -ggdb -pedantic -std=c99 test.c -lncursesw -o test
int main()
{
char charo[200];
setlocale(LC_ALL, "");
initscr();
mvprintw(0,0, "Hello World !!!");
mvprintw(4,0, "Simple Lines:");
mvaddch( 5, 5, ACS_VLINE );
mvaddch( 7, 5, ACS_HLINE );
mvprintw(9,0, "Double Lines: ║");
addstr("▄");
charo[0]=VRT;
charo[1]='\0';
mvprintw( 10 , 0 , "here the mega test for x2551: ");
addstr( charo );
refresh(); /* Print it on to the real screen */
getch(); /* Wait for user input */
endwin(); /* End curses mode */
return 0;
}
it gives:
Code:
Hello World !!!
Simple Lines:
│
─
Double Lines: ║▄
here the mega test for x2551: Q
where Q is not be displayed well. It shall be a '║'!
Furthermore, then, I look into the pdcurses with 'w', into curses.h, I see no WACS_D_HLINE. To me, it seems that the Linux and Windows Wide aren't so much compatible. I http://sourceforge.net/projects/pdcu...w.zip/download
I would be happy that a C code with ACS_D_HLINE could work on both platforms.
In the above example, I have tried to compile but visibly sthg wrong.
...
I have this current code:
...
Yes, you dropped the lines:
Code:
#define NCURSES_WIDECHAR 1 /* defining _XOPEN_SOURCE >= 500 also works */
#include <ncursesw/ncurses.h>
Quote:
In this following version of the code, I try not to use the WACS_D_... since it is not defined into pdcursesw. I would like that my code with double lines, works either on linux and windows.
Code:
...
const wchar_t
VRT = L'\x2551', // ║
HRZ2 = L'\x2550', // ═
HRZ1 = L'\x2500', // ─
TUP = L'\x2569';
...
int main()
{
char charo[200];
...
charo[0]=VRT;
charo[1]='\0';
mvprintw( 10 , 0 , "here the mega test for x2551: ");
addstr( charo );
...
}
This can't work, you tried to put a wchar_t into a char, they're not the same size.
Quote:
Furthermore, then, I look into the pdcurses with 'w', into curses.h, I see no WACS_D_HLINE. To me, it seems that the Linux and Windows Wide aren't so much compatible. I http://sourceforge.net/projects/pdcu...w.zip/download
I would be happy that a C code with ACS_D_HLINE could work on both platforms.
I don't even see ACS_D_HLINE in the pdcurses curses.h. I do see mvadd_wch(), it's inside an #ifdef PDC_WIDE so you should try #defining that before #including the pdcurses header.
However, under Windows, I have an issue... as follows from this program compiled wiht pdcursesw (<-- wiht w).
I took term.h from the src code of pdcurses.
gif attached.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.