1. 使用 readline (设置 Linker)
1-1. 项目右键 -> Buil Options... -> Linker Settings -> Add -> OK
1-2. Settings -> Compiler and debugger... -> Global compiler settings -> Linker Settings -> Add -> OK
添加 readline, curses 等
2. 测试代码
#include <stdio.h>
#include <stdlib.h>
#include <readline/readline.h>
#include <readline/history.h>
int main()
{
char *ptr;
using_history();
read_history(NULL);
while((ptr = readline("> ")))
{
add_history(ptr);
puts(ptr);
free(ptr);
}
write_history(NULL);
return 0;
}
0 件のコメント:
コメントを投稿