Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: Yet another fseek() question Message-ID: <6442@brl-smoke.ARPA> Date: Sun, 20-Sep-87 20:47:49 EDT Article-I.D.: brl-smok.6442 Posted: Sun Sep 20 20:47:49 1987 Date-Received: Mon, 21-Sep-87 03:39:42 EDT References: <165600012@uiucdcsb> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 32 In article <165600012@uiucdcsb> kenny@uiucdcsb.cs.uiuc.edu writes: >Fseek() as described for TEXT files can be made to work even on >magnetic tapes with comparatively little effort, except for one minor >problem: tapes cannot reliably read data beyind the last data >written. >Yet I don't see anything in the standard forbidding forward read after >write. Did the implementors not consider tape I/O, figure that an >implementation can just disallow "r+" and "w+" modes for tapes, >consider tapes to be non-seekable files (but they CAN forward-space, >backspace, and rewind), or have I overlooked something? The following is NOT an official X3J11 response: Magtapes have always been problematic for simple file models. (Consider that some interfaces do not support writing records containing an odd number of bytes, and that one cannot in general write on a magtape file unless there are no files following it.) If an implementation cannot support the "+" modes in a reasonable manner (block-replaceable magtape a la DECtape), then it really ought to return an error indication when an attempt is made to open a magtape device in such a mode. Alternatively, it could defer the error indication until the I/O operation that won't work right is attempted, although this is much less desirable. I know that it is hard to construct such an implementation on some operating systems (including many UNIX variants), but there really isn't much that can be done about this at the C standardization level. Not all magtape implementations allow convenient access to positioning operations. In particular, some older UNIX magtape drivers did not support such operations (other than rewind, and occasionally file-skip on close).