tst-setvbuf1.c 718 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* Dereived from the test case in BZ #2337. */
  2. #include <errno.h>
  3. #include <error.h>
  4. #include <fcntl.h>
  5. #include <locale.h>
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <unistd.h>
  10. #include <wchar.h>
  11. static char buf[512] __attribute__ ((aligned (4096)));
  12. static int
  13. do_test (void)
  14. {
  15. setlocale (LC_ALL, "de_DE.UTF-8");
  16. FILE *fp = fdopen (dup (STDOUT_FILENO), "a");
  17. if (fp == NULL)
  18. error (EXIT_FAILURE, errno, "fdopen(,\"a\")");
  19. setvbuf (fp, buf, _IOFBF, sizeof (buf));
  20. /* fwprintf to unbuffered stream. */
  21. fwprintf (fp, L"hello.\n");
  22. fclose (fp);
  23. /* touch my buffer */
  24. buf[45] = 'a';
  25. return 0;
  26. }
  27. #define TEST_FUNCTION do_test ()
  28. #include "../test-skeleton.c"