Re: getline function

2006-02-20 Thread Michael P. Soulier
On 18/02/06 Tom Grove said: That works and I had looked into that earlier...it seems like it does a lot more than just one function from the man page. I guess I can use that for now but I wonder why getline() is broken in gcc on FreeBSD? getline() is from glibc. FreeBSD uses it's own libc.

Re: getline function

2006-02-18 Thread Tom Grove
Mike Jeays wrote: On Fri, 2006-02-17 at 21:54 -0500, Tom Grove wrote: Is there anyone who can compile a program using the getline() function? Here is a really simple program to recreate the following error: ##Error## /var/tmp//ccvYIi4C.o(.text+0x26): In function `main': : undefined

Re: getline function

2006-02-18 Thread Chuck Swiger
Tom Grove wrote: Mike Jeays wrote: [ ... ] That works and I had looked into that earlier...it seems like it does a lot more than just one function from the man page. I guess I can use that for now but I wonder why getline() is broken in gcc on FreeBSD? getline() is not part of the standard C

Re: getline function

2006-02-18 Thread Tom Grove
? 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

Re: getline function

2006-02-18 Thread Tom Grove
Mike Jeays wrote: On Fri, 2006-02-17 at 21:54 -0500, Tom Grove wrote: Is there anyone who can compile a program using the getline() function? Here is a really simple program to recreate the following error: ##Error## /var/tmp//ccvYIi4C.o(.text+0x26): In function `main': : undefined

Re: getline function

2006-02-18 Thread Chuck Swiger
to grab lines? My gut tells me to copy the getline() function from the KR 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

Re: getline function

2006-02-18 Thread Tom Grove
() is not safe to use what should I use to grab lines? My gut tells me to copy the getline() function from the KR 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

Re: getline function

2006-02-18 Thread James Bailie
Tom Grove wrote: ##Error## /var/tmp//ccqxIZxQ.o(.text+0x25): In function `main': : undefined reference to `readline' ##Error## You forgot to pass -lreadline to the compiler. -- James Bailie [EMAIL PROTECTED] http://www.jamesbailie.com ___

Re: getline function

2006-02-18 Thread Mike Jeays
On Sat, 2006-02-18 at 13:00 -0500, Tom Grove wrote: Mike Jeays wrote: On Fri, 2006-02-17 at 21:54 -0500, Tom Grove wrote: Is there anyone who can compile a program using the getline() function? Here is a really simple program to recreate the following error: ##Error## /var/tmp

Re: getline function

2006-02-18 Thread Mike Jeays
On Sat, 2006-02-18 at 15:33 -0500, Tom Grove wrote: #include stdio.h #include readline/readline.h #include readline/history.h int main() { char *line; line = readline(Test: ); return 0; } It compiles and works with gcc -o readline readline.c -l readline. You

Re: getline function

2006-02-18 Thread Giorgos Keramidas
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 KR 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

Re: getline function

2006-02-18 Thread Giorgos Keramidas
tells me to copy the getline() function from the KR book but I'm not totally sure that's a great idea either. Stupid strings always causing problems! This is a frequently recurring question in comp.lang.c. There are perfectly portable ways to use only ANSI C functions to read a full line of text

getline function

2006-02-17 Thread Tom Grove
Is there anyone who can compile a program using the getline() function? Here is a really simple program to recreate the following error: ##Error## /var/tmp//ccvYIi4C.o(.text+0x26): In function `main': : undefined reference to `getline' ##Error## ##Source File## #include stdio.h int main

Re: getline function

2006-02-17 Thread Mike Jeays
On Fri, 2006-02-17 at 21:54 -0500, Tom Grove wrote: Is there anyone who can compile a program using the getline() function? Here is a really simple program to recreate the following error: ##Error## /var/tmp//ccvYIi4C.o(.text+0x26): In function `main': : undefined reference to `getline