From owner-freebsd-questions@FreeBSD.ORG Sat Feb 18 18:01:15 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E1E2616A420 for ; Sat, 18 Feb 2006 18:01:15 +0000 (GMT) (envelope-from freebsd@voidmain.net) Received: from pgh.nepinc.com (pgh.nepinc.com [66.207.129.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 779EE43D45 for ; Sat, 18 Feb 2006 18:01:15 +0000 (GMT) (envelope-from freebsd@voidmain.net) Received: from [192.168.1.108] (monrovll-cuda1-69-164-173-96.pittpa.adelphia.net [69.164.173.96]) (authenticated bits=0) by pgh.nepinc.com (8.12.11/8.12.11) with ESMTP id k1II1E61095048; Sat, 18 Feb 2006 13:01:14 -0500 (EST) (envelope-from freebsd@voidmain.net) Message-ID: <43F760D8.6000506@voidmain.net> Date: Sat, 18 Feb 2006 13:00:56 -0500 From: Tom Grove Organization: VoidMain.net User-Agent: Thunderbird 1.5 (X11/20060210) MIME-Version: 1.0 To: Mike Jeays References: <43F68C7D.9010403@voidmain.net> <1140233843.982.21.camel@chaucer.jeays.ca> In-Reply-To: <1140233843.982.21.camel@chaucer.jeays.ca> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: getline function X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd@voidmain.net List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Feb 2006 18:01:16 -0000 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 >> >> 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 > #include > > 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