1 /* Check regression of a bug uncovered by the libio tFile test (old
2 libstdc++, pre-gcc-3.x era), where appending to a file doesn't work.
3 The default open-flags-mapping does not match Linux/CRIS, so a
4 specific mapping is necessary. */
14 const char fname
[] = "sk1test.dat";
16 = "This is the first and only line of this file.\n";
17 const char tsttxt2
[] = "Now there is a second line.\n";
18 char buf
[sizeof (tsttxt1
) + sizeof (tsttxt2
) - 1] = "";
20 f
= fopen (fname
, "w+");
22 || fwrite (tsttxt1
, 1, strlen (tsttxt1
), f
) != strlen (tsttxt1
)
29 f
= fopen (fname
, "a+");
31 || fwrite (tsttxt2
, 1, strlen (tsttxt2
), f
) != strlen (tsttxt2
)
38 f
= fopen (fname
, "r");
40 || fread (buf
, 1, sizeof (buf
), f
) != sizeof (buf
) - 1
41 || strncmp (buf
, tsttxt1
, strlen (tsttxt1
)) != 0
42 || strncmp (buf
+ strlen (tsttxt1
), tsttxt2
, strlen (tsttxt2
)) != 0