magic cookies given back by ftell, and used in fseek

William E. Davidsen Jr davidsen at steinmetz.ge.com
Fri May 27 02:27:31 AEST 1988


In article <129 at lakart.UUCP> dg at lakart.UUCP (David Goodenough) writes:
>There has been much discussion in this group on the fact that on certain
>systems (VMS I believe), ftell & fseek use magic cookies to tell about

  As far as I know the value returned by (f)tell is a real address in
the file. The kicker is that the beginning of consecetive ten byte lines
may not be ten bytes apart, or even any fixed number of bytes. This is
an artifact of VMS having 11 (or so) file types.

  At one time the C library was so hosed that I gave my SysMgr the
following for report as an SPR:

	Problem: random i/o in VMS-C doesn't work

	Demo:
	... read part of a file ...
	val1 = ftell();		/* ask where we are	*/
	val2 = ftell();		/* ask again		*/
	if (val1 != val2) 
	{ /* this system hasn't a clue... */
	  fprintf(stderr, "Random file access error\n");
	  exit(2);
	}

Needless to say I wrote my own i/o routines from scratch, since we
couldn't wait for a fix. I'm told that the reply was "This will be fixed
in a future release." I'm glad I operate one level away from the vendor
(in VMS at least).
-- 
	bill davidsen		(wedu at ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.lang.c mailing list