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 %jd, expected %zu\n",
32 printf ("second ftello returned %jd, expected 0\n", (intmax_t) o);
35 if (fseeko (fp, 0, SEEK_END) != 0)
37 puts ("fseeko failed");
43 printf ("third ftello returned %jd, expected %zu\n",
48 static const char str2[] = "just hello";
49 #define nstr2 (sizeof (str2) - 1)
50 assert (nstr2 < nstr);
55 printf ("fourth ftello returned %jd, expected %zu\n",
60 static const char str3[] = "just hellod";
61 if (strcmp (buf, str3) != 0)
63 printf ("final string is \"%s\", expected \"%s\"\n",
70 #define TEST_FUNCTION do_test ()
71 #include "../test-skeleton.c"