Back to index

glibc  2.9
Defines | Functions
tstgetln.c File Reference
#include <stdio.h>

Go to the source code of this file.

Defines

#define ssize_t   _IO_ssize_t

Functions

int main (int argc, char *argv[])

Define Documentation

#define ssize_t   _IO_ssize_t

Definition at line 22 of file tstgetln.c.


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 25 of file tstgetln.c.

{
  char *buf = NULL;
  size_t size = 0;
  ssize_t len;

  while ((len = getline (&buf, &size, stdin)) != -1)
    {
      printf ("bufsize %Zu; read %Zd: ", size, len);
      if (fwrite (buf, len, 1, stdout) != 1)
       {
         perror ("fwrite");
         return 1;
       }
    }

  if (ferror (stdin))
    {
      perror ("getline");
      return 1;
    }

  return 0;
}

Here is the call graph for this function: