readline / Gnu readline
Adam D. Ruppe
destructionator at gmail.com
Wed Jan 29 21:15:08 UTC 2020
On Wednesday, 29 January 2020 at 20:01:32 UTC, Michael wrote:
> I am new to D.
> I would like to use the Gnu readline function in D. Is there a
> module that i can use?
just define it yourself
---
// this line right here is all you need to call the function
extern(C) char* readline(const char*);
import core.stdc.stdio;
void main() {
char* a = readline("prompt> ");
printf("%s\n", a);
}
---
# and also link it in at the command line with -L-lreadline
dmd rl -L-lreadline
readline is so simple you don't need to do anything fancier. If
you need history and such too you just define those functions as
well.
More information about the Digitalmars-d-learn
mailing list