Name: Anonymous 2011-02-10 17:32
/prog/, I want to learn C. I worked forever on this piece of code, please help me complete it. So far it does nothing. but i want to build a dwarf fortress. please build upon my code.
#include <stdio.h>
#include <stdlib.h>
#include <readline/readline.h>
#include <readline/history.h>
int main(void) {
char *prompt = "> ";
char *line;
while (!feof(stdin)) {
if ((line = readline(prompt)) == NULL) break;
if (!line[0]) {
free(line);
continue;
}
add_history(line);
printf( "%s\n", line);
free(line);
}
printf("\n");
return 0;
}