C++ 言語での readline の使い方。 // c++ rl.cpp -lreadline -lcurses #include <stdio.h> #include <readline/readline.h> #include <readline/history.h> #include <string> #include <iostream> int main() { using namespace std; char *ptr; string line; using_history(); read_history(NULL); while(ptr = readline("rl++:")) { add_history(ptr); line = ptr; cout << line << endl; free(ptr); } write_history(NULL); } ほぼ C 言語で