ncurses

how can I write an ANSI C console screen buffer?

僤鯓⒐⒋嵵緔 提交于 2019-12-01 19:56:52
I'm working on making an ASCII based game, and everywhere I look people are saying to use Console.Write() from MSDN, which is dandy and all if you're using Windows, but I'm not. And thus, I'm trying to write a function, or group of functions in C that can alternate between two screen buffers, and write them to the screen, similar to what man pages would be like, as well as pico, vim, and emacs. I have the buffer's working, and found an old ASCII game for linux called 0verkill that uses C and putchar() to place each character on the screen, but all of my attempts to re-create that, result in a

Read a string with ncurses in C++

风格不统一 提交于 2019-12-01 19:46:19
I'm writing a text-based game in C++. At some point, I ask the user to input user names corresponding to the different players playing. I'm currently reading single char from ncurses like so: move(y,x); printw("Enter a char"); int char = getch(); However, I'm not sure how to a string. I'm looking for something like: move(y,x); printw("Enter a name: "); std::string name = getstring(); I've seen many different guides for using ncurses all using a different set of functions that the other doesn't. As far as I can tell the lines between deprecated and non-deprecated functions is not very well

Cross platform solution for automating ncurses-type telnet sessions

旧城冷巷雨未停 提交于 2019-12-01 19:28:33
Background Part of my work in networking and telco involves automating telnet sessions when legacy hardware doesn't offer easy solutions in other interfaces. Many older pieces of equipment can only be accessed via craft ports (RS-232 serial ports), SNMP, or telnet. Sometimes telnet is the only way to access specific information, however telnet is designed as a human interface and thus requires screen scraping. In addition, there is also the issue of scraping screens where only portions are updated in order to save bandwidth (see ncurses ). In my work I have used ActiveState Expect and the

Debugging ncurses with Eclipse CDT

可紊 提交于 2019-12-01 16:52:28
I'm writing a C++ application using ncurses in Eclipse CDT however I can't run/debug my app in eclipse because the console in eclipse does not work with curses. My app runs fine if I run it from a terminal but I just added some new code and now I'm getting a segmentation fault so I'd like to use the debugger in eclipse to help me fix the issue. Is there a way to have eclipse run/debug my application but use a different terminal for the output much like when you do "tty /dev/pts/1" in gdb? Or any other way to debug a ncures application in eclipse? Thx in advance! lolikandr also you should add

NCurses initialization without clearing the screen

本小妞迷上赌 提交于 2019-12-01 16:48:05
I am writing a program that's similar to a shell. Once started up, there's a prompt and you enter in some app-specific commands. So far this works just fine. However, I want to add support for command history like in Bash, so the user could hit the up or down arrow and see previously entered commands. I have included the ncurses library, and I have done a simple hello world test with getch() to make sure the up and down arrows are reported correctly. The thing that's bothering me is that it seems to be a requirement that I call initscr() which will clear the screen in order for me to use getch

What mechanism allows ViM to temporarily overwrite the entire console?

点点圈 提交于 2019-12-01 16:05:06
When you enter vim , it "clears" the screen. Upon exiting, it "restores" the original contents. I understand one can use \x1b[2J to clear the console and reset the cursor position, but this will overwrite terminal contents. I assume Vim uses ncurses under the hood, in which case I suppose the better question is how ncurses does this, but how is it done? Most terminal emulators are able to save and restore the contents of the screen. The terminfo codes for this are smcup to enter full-screen mode and rmcup to leave it. (The older termcap codes are ti and te .) If these capabilities are enabled

NCurses initialization without clearing the screen

落花浮王杯 提交于 2019-12-01 14:52:42
问题 I am writing a program that's similar to a shell. Once started up, there's a prompt and you enter in some app-specific commands. So far this works just fine. However, I want to add support for command history like in Bash, so the user could hit the up or down arrow and see previously entered commands. I have included the ncurses library, and I have done a simple hello world test with getch() to make sure the up and down arrows are reported correctly. The thing that's bothering me is that it

What mechanism allows ViM to temporarily overwrite the entire console?

爷,独闯天下 提交于 2019-12-01 14:43:53
问题 When you enter vim, it "clears" the screen. Upon exiting, it "restores" the original contents. I understand one can use \x1b[2J to clear the console and reset the cursor position, but this will overwrite terminal contents. I assume Vim uses ncurses under the hood, in which case I suppose the better question is how ncurses does this, but how is it done? 回答1: Most terminal emulators are able to save and restore the contents of the screen. The terminfo codes for this are smcup to enter full

How to Build Curses Program That Supports More Than 223 Columns of Mouse Input

只谈情不闲聊 提交于 2019-12-01 14:43:30
I'm trying to get a curses program working with my terminal spanning my monitor. However, the x coordinate can't move past the 223rd column, instead it loops around. In the source, this seems to be due to them being defined as 8-bits, and having the position values start only after the first 32 values (i.e. x = raw_x - ' '). Here's an example program from https://gist.github.com/sylt/93d3f7b77e7f3a881603 that demonstrates the issue when compiled with libncurses5. In it, if your cursor moves more than 233 columns to the right of the window, the x value will loop back over to 0 - ' ', i.e. -32

How to Build Curses Program That Supports More Than 223 Columns of Mouse Input

*爱你&永不变心* 提交于 2019-12-01 12:22:55
问题 I'm trying to get a curses program working with my terminal spanning my monitor. However, the x coordinate can't move past the 223rd column, instead it loops around. In the source, this seems to be due to them being defined as 8-bits, and having the position values start only after the first 32 values (i.e. x = raw_x - ' '). Here's an example program from https://gist.github.com/sylt/93d3f7b77e7f3a881603 that demonstrates the issue when compiled with libncurses5. In it, if your cursor moves