Created
September 8, 2014 19:34
-
-
Save eraserhd/c3b0b7cbea65239d80c6 to your computer and use it in GitHub Desktop.
Some curses stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <curses.h> | |
| #include <iostream> | |
| #include <string> | |
| std::string myfunc() | |
| { | |
| std::string result = "Hello, World!"; | |
| return result; | |
| } | |
| int main() | |
| { | |
| initscr(); // Prolly need to do more setup-y things | |
| std::string what_to_show = myfunc(); | |
| addstr(what_to_show.c_str()); | |
| char buf[256]; | |
| getstr(buf); // getstr writes into buf | |
| std::string a_c_plus_plus_string = buf; // Convert C-style character buffer to C++ string. | |
| endwin(); | |
| std::cout << "you typed: " << a_c_plus_plus_string << std::endl; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment