1 /* Check that basic freopen functionality works. */
12 const char fname
[] = "sk1test.dat";
14 = "A random line of text, used to test correct freopen etc.\n";
15 char buf
[sizeof tsttxt
] = "";
17 /* Like the freopen call in flex. */
18 old_stderr
= freopen (fname
, "w+", stderr
);
19 if (old_stderr
== NULL
20 || fwrite (tsttxt
, 1, strlen (tsttxt
), stderr
) != strlen (tsttxt
)
21 || fclose (stderr
) != 0)
27 /* Using "rb" to make this test similar to the use in genconf.c in
29 f
= fopen (fname
, "rb");
31 || fseek (f
, 0L, SEEK_END
) != 0
32 || ftell (f
) != strlen (tsttxt
))
39 if (fread (buf
, 1, strlen (tsttxt
), f
) != strlen (tsttxt
)
40 || strcmp (buf
, tsttxt
) != 0
This page took 0.033028 seconds and 4 git commands to generate.