12 FILE *fp
= fmemopen (buf
, sizeof (buf
), "w");
15 puts ("fmemopen failed");
18 static const char str
[] = "hello world";
19 #define nstr (sizeof (str) - 1)
21 off_t o
= ftello (fp
);
24 printf ("first ftello returned %ld, expected %zu\n", o
, nstr
);
31 printf ("second ftello returned %ld, expected 0\n", o
);
34 if (fseeko (fp
, 0, SEEK_END
) != 0)
36 puts ("fseeko failed");
42 printf ("third ftello returned %ld, expected %zu\n", o
, nstr
);
46 static const char str2
[] = "just hello";
47 #define nstr2 (sizeof (str2) - 1)
48 assert (nstr2
< nstr
);
53 printf ("fourth ftello returned %ld, expected %zu\n", o
, nstr2
);
57 static const char str3
[] = "just hellod";
58 if (strcmp (buf
, str3
) != 0)
60 printf ("final string is \"%s\", expected \"%s\"\n",
67 #define TEST_FUNCTION do_test ()
68 #include "../test-skeleton.c"