Back to index

glibc  2.9
Defines | Functions
tst-fgets.c File Reference
#include <stdio.h>
#include "../test-skeleton.c"

Go to the source code of this file.


#define TEST_FUNCTION   do_test ()


static int do_test (void)

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 19 of file tst-fgets.c.

Function Documentation

static int do_test ( void  ) [static]

Definition at line 6 of file tst-fgets.c.

  FILE *fp = fmemopen ((char *) "hello", 5, "r");
  char buf[2];
  char *bp = fgets (buf, sizeof (buf), fp);
  printf ("fgets: %s\n", bp == buf ? "OK" : "ERROR");
  int res = bp != buf;
  bp = fgets_unlocked (buf, sizeof (buf), fp);
  printf ("fgets_unlocked: %s\n", bp == buf ? "OK" : "ERROR");
  res |= bp != buf;
  return res;

Here is the call graph for this function: