1 /* Test program for fsetpos on a wide character stream. */
7 static void do_prepare (void);
8 #define PREPARE(argc, argv) do_prepare ()
9 static int do_test (void);
10 #define TEST_FUNCTION do_test ()
11 #include <test-skeleton.c>
13 static const char pattern
[] = "12345";
14 static char *temp_file
;
19 int fd
= create_temp_file ("bug-wsetpos.", &temp_file
);
22 printf ("cannot create temporary file: %m\n");
25 write (fd
, pattern
, sizeof (pattern
));
32 FILE *fp
= fopen (temp_file
, "r");
38 printf ("fdopen: %m\n");
42 c
= fgetwc (fp
); assert (c
== L
'1');
43 c
= fgetwc (fp
); assert (c
== L
'2');
45 if (fgetpos (fp
, &pos
) == EOF
)
47 printf ("fgetpos: %m\n");
54 printf ("rewind: %m\n");
58 c
= fgetwc (fp
); assert (c
== L
'1');
60 if (fsetpos (fp
, &pos
) == EOF
)
62 printf ("fsetpos: %m\n");
69 puts ("fsetpos failed");
73 puts ("Test succeeded.");