Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!ucbvax!decwrl!labrea!rutgers!att!pegasus!psrc From: psrc@pegasus.ATT.COM (Paul S. R. Chisholm) Newsgroups: comp.sys.ibm.pc Subject: Re: HELP need in C (turbo c, fopen problem) Summary: You're missing the point of a FILE* Message-ID: <2829@pegasus.ATT.COM> Date: 26 Apr 89 01:05:06 GMT References: <353@h.cs.wvu.wvnet.edu> Organization: AT&T Bell Laboratories Lines: 28 In article <353@h.cs.wvu.wvnet.edu>, packer@a.cs.wvu.wvnet.edu (Michael A Packer) writes: > i am trying to open a file. When i open the file my filepointer is > being returned (not null). When i look at what fp is pointing to > there is garbage in the "buffer" and "curp" as declared by FILE. A draft of X3J11/88-001 (the ANSI C standard) says: > FILE . . . is an object type capable of recording all the information > needed to control a stream, including its file position indicator, a > pointer to its associated buffer, an error indicator that records > whether a read/write error has occurred, and an end-of-file indicator > that records whether the end of the file has been reached. (section 4.9.1, page 121 of draft issued May 13, 1988) Michael, a FILE is an abstract data type. No one, not Borland, not the ANSI C committee, makes any promises about any of the fields in this structure, or even that a FILE is a structure! If your program is clearly broken (and you can tell that from some later, purely external behavior), then look at what's broken. The fields of a FILE might not be set at open time; you may have to wait until the first write for them to be initialized. But why are you bothering? > michael packer, packer@a.cs.wvu.wvnet.edu, un027661@wvnvaxb.wvnet.edu > {allegra,bellcore,ihpn4!cadre,decvax!idis,psuvax1}!pitt!wvucsa!packer Paul S. R. Chisholm, AT&T Bell Laboratories att!pegasus!psrc, psrc@pegasus.att.com, AT&T Mail !psrchisholm I'm not speaking for the company, I'm just speaking my mind.