Date: Sat, 18 Feb 2006 15:53:50 -0500 From: Mike Jeays <mj001@rogers.com> To: freebsd@voidmain.net Cc: freebsd-questions@freebsd.org Subject: Re: getline function Message-ID: <1140296030.24729.1.camel@chaucer.jeays.ca> In-Reply-To: <43F760D8.6000506@voidmain.net> References: <43F68C7D.9010403@voidmain.net> <1140233843.982.21.camel@chaucer.jeays.ca> <43F760D8.6000506@voidmain.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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//ccvYIi4C.o(.text+0x26): In function `main': > >> : undefined reference to `getline' > >> ##Error## > >> > >> ##Source File## > >> #include <stdio.h> > >> > >> int main() { > >> char line[10]; > >> > >> getline(&line, 10); > >> printf("%s", line); > >> > >> return 0; > >> } > >> ## Source File## > >> > >> -Tom > >> _______________________________________________ > >> freebsd-questions@freebsd.org mailing list > >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions > >> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" > >> > > > > I got a bit further by installing the port for getline > > (/usr/ports/devel/libgetline), and changed the code slightly to provide > > a single parameter. (Look at man getline) > > > > #include <stdio.h> > > #include <getline.h> > > > > int main() { > > char line[10]="test"; > > > > getline(line); > > printf("%s", line); > > > > return 0; > > } > > > > chaucer 29 ~/c $ cc -o getline -I/usr/local/include -L/usr/local/lib > > getline.c -lgetline > > chaucer 30 ~/c $ getline > > testnow > > testchaucer 31 ~/c $ > I also noticed that this code actually doesn't work...I'm not sure why > either but it doesn't output what gets typed. Notice that the 'now' > that gets typed isn't echoed below. > > -Tom > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" Yes - that's why I said I "got a bit further", not that I had made it work. I have never tried to use it before, and would have to experiment more. -- Mike Jeays http://ca.geocities.com/mike.jeays@rogers.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1140296030.24729.1.camel>