This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: getline is missing on solaris gcc 3.3.2
- From: Ian Lance Taylor <ian at airs dot com>
- To: Jeff <jeff at caesoft dot biz>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 26 Jan 2005 21:23:25 -0500
- Subject: Re: getline is missing on solaris gcc 3.3.2
- References: <41F849B3.8050801@caesoft.biz>
Jeff <jeff@caesoft.biz> writes:
> I'm trying to compile on Solaris 8 using gcc 3.3.2. This simple test
> does not compile, saying that it can't find getline. Where is getline on
> Solaris? This works fine on Linux.
>
> #define _GNU_SOURCE
> #include <cstdio>
>
> int main(int argc, char* const* argv)
> {
> FILE* fp = fopen("test","r");
> size_t n;
> char* lineptr = new char[80];
> ssize_t n_read = getline(&lineptr, &n, fp);
> }
Questions about ordinary library functions are not questions about
gcc, and they should not go to gcc-help.
The getline function is not portable. It is GNU/Linux specific. It
is documented as such on the manpage and in the libc manual. The
function is not available in the Solaris libraries. You will have to
provide your own version.
Ian