Skip to contentSkip to conversation

getline()

DISCUSSION Progga 6 participants 6 messages Aug 24, 2003 – Aug 25, 2003

lore
Share & tools
lore

Progga

author
#0 lore raw

Is there any 'C' lib which contains the getline() function ? I have found
a code similar to this:

-------

char *temp ;
int n = 0 ;
FILE *file_handle = NULL ;

// [snipped]

getline(&temp, &n, file_handle);

--------

But there's no prototype declaration and 'greping' through the '*/includes/'
havn't produced anything relevant either.

Khoda Hafez
Progga

#1 lore raw
Quoted 6 lines · Progga

Is there any 'C' lib which contains the getline() function ? I have found
a code similar to this:

-------

Quoted 7 lines

char *temp ;
int n = 0 ;
FILE *file_handle = NULL ;

// [snipped]

getline(&temp, &n, file_handle);

Aren't you searching for fgets() ?

char line[1024];

while((fgets(line, 1024, stdin)) != NULL)
printf("%s", line);

Quoted 3 lines

Khoda Hafez
Progga

JM

#2 lore raw
In reply to Progga
Quoted 2 lines · Progga

Is there any 'C' lib which contains the getline() function ?

getline() is in libc. The prototype is in stdio.h, but you may need to use -D_GNU_SOURCE to enable it.

Signature · 1 line
Glynn Clements <[email protected]>
#3 lore raw
Quoted 3 lines

getline() is in libc. The prototype is in stdio.h, but you may need to use -D_GNU_SOURCE to enable it.

...and then you won't be able to use it with the dietlibc anymore...

no good idea ihmo.

Nico

#4 lore raw

In article <[email protected]>,

Quoted 4 lines · Nico Schottelius
Quoted 2 lines

getline() is in libc. The prototype is in stdio.h, but you may need to use -D_GNU_SOURCE to enable it.

..and then you won't be able to use it with the dietlibc anymore...

Why? If you use getline(), you should be providing your own version for systems that don't have it. If they have it, great, use the system version, if they don't, use yours.

mrc

Signature · 3 lines
     Mike Castle      [email protected]      www.netcom.com/~dalgoda/
    We are all of us living in the shadow of Manhattan.  -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc
#5 lore raw
In reply to Progga
Quoted 2 lines · Progga

Is there any 'C' lib which contains the getline() function ? I have found
a code similar to this:

Getline is part of the GNU readline package, and is included in GNU libc, the standard libc used on GNU/Linux systems (as a GNU extension -- #define _GNU_SOURCE). Readline is include I believe in FreeBSD's libc, and available as a package for NetBSD. See: <http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html>

readline 4.3: <ftp://ftp.cwru.edu/pub/bash/readline-4.3.tar.gz>

Signature · 1 line
Michael Taylor