11 FILE *fp
= fmemopen (buf
, sizeof (buf
), "w");
14 puts ("fmemopen failed");
17 static const char str
[] = "hello world";
18 #define nstr (sizeof (str) - 1)
20 off_t o
= ftello (fp
);
23 printf ("first ftello returned %ld, expected %zu\n", o
, nstr
);
30 printf ("second ftello returned %ld, expected %zu\n", o
, 0);
33 if (fseeko (fp
, 0, SEEK_END
) != 0)
35 puts ("fseeko failed");
41 printf ("third ftello returned %ld, expected %zu\n", o
, nstr
);
45 static const char str2
[] = "just hello";
46 #define nstr2 (sizeof (str2) - 1)
47 assert (nstr2
< nstr
);
52 printf ("fourth ftello returned %ld, expected %zu\n", o
, nstr2
);
56 static const char str3
[] = "just hellod";
57 if (strcmp (buf
, str3
) != 0)
59 printf ("final string is \"%s\", expected \"%s\"\n",
66 #define TEST_FUNCTION do_test ()
67 #include "../test-skeleton.c"