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
12
13static char buf[512] __attribute__ ((aligned (4096)));
14
15
16static int
17do_test (void)
18{
19 setlocale (LC_ALL, "de_DE.UTF-8");
20
21 FILE *fp = fdopen (dup (STDOUT_FILENO), "a");
22 if (fp == NULL)
23 error (EXIT_FAILURE, errno, format: "fdopen(,\"a\")");
24
25 setvbuf (stream: fp, buf: buf, _IOFBF, n: sizeof (buf));
26
27 /* fwprintf to unbuffered stream. */
28 fwprintf (stream: fp, format: L"hello.\n");
29
30 fclose (fp);
31
32 /* touch my buffer */
33 buf[45] = 'a';
34
35 return 0;
36}
37
38#define TEST_FUNCTION do_test ()
39#include "../test-skeleton.c"
40

source code of glibc/libio/tst-setvbuf1.c