Chuck Swiger wrote:
Tom Grove wrote:
Chuck Swiger wrote:
[ ... ]
getline() is not part of the standard C library.
What makes you think gcc is broken...?
Yeah...I see that after some more research. So, now I guess my question
is being that it's not standard and gets() is not safe to use what
should I use to grab lines? My gut tells me to copy the getline()
function from the K&R book but I'm not totally sure that's a great idea
either. Stupid strings always causing problems!
Depending on what you'd like to do, GNU readline may be a fine solution to your
situation. Otherwise, getch(stdin) with a bit of code to "cook" DEL/BS/CR/NL,
or just use the getline port as you've already done. :-)
Okay...I think I'm either an idiot or going slowly insane. I'll admit
I'm not the most savvy C programmer but the following code gives me an
error:
## Source File##
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
int main() {
char *line;
line = readline("Test: ");
return 0;
}
##Source File##
##Error##
/var/tmp//ccqxIZxQ.o(.text+0x25): In function `main':
: undefined reference to `readline'
##Error##
What sucks is that readline() seems like it would be the perfect
solution. I'm not doing anything special but my I don't want to start
getting into bad habits like using gets().
-Tom
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"