eeb6079fdb51f66c92a8607aca1e527c03312205
1 /* Check that basic freopen functionality works.
3 Currently doesn't work, because syscall.c:cb_syscall case
4 CB_SYS_write intercepts writes to fd 1 and 2. */
15 const char fname
[] = "sk1test.dat";
17 = "A random line of text, used to test correct freopen etc.\n";
18 char buf
[sizeof tsttxt
] = "";
20 /* Like the freopen call in flex. */
21 old_stderr
= freopen (fname
, "w+", stderr
);
22 if (old_stderr
== NULL
23 || fwrite (tsttxt
, 1, strlen (tsttxt
), stderr
) != strlen (tsttxt
)
24 || fclose (stderr
) != 0)
30 /* Using "rb" to make this test similar to the use in genconf.c in
32 f
= fopen (fname
, "rb");
34 || fseek (f
, 0L, SEEK_END
) != 0
35 || ftell (f
) != strlen (tsttxt
))
42 if (fread (buf
, 1, strlen (tsttxt
), f
) != strlen (tsttxt
)
43 || strcmp (buf
, tsttxt
) != 0
This page took 0.030066 seconds and 3 git commands to generate.