home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!cs.utexas.edu!torn!watserv1!watdragon.waterloo.edu!watstat.waterloo.edu!dmurdoch
- From: dmurdoch@watstat.waterloo.edu (Duncan Murdoch)
- Subject: Re: Variable record files
- Message-ID: <Brsx24.HEx@watdragon.waterloo.edu>
- Sender: news@watdragon.waterloo.edu (USENET News System)
- Reply-To: dmurdoch@mast.queensu.ca
- Organization: Queen's University
- References: <1992Jul22.131206.51534@ns1.cc.lehigh.edu>
- Date: Wed, 22 Jul 1992 17:39:39 GMT
- Lines: 24
-
- In article <1992Jul22.131206.51534@ns1.cc.lehigh.edu> bsc0@ns1.cc.lehigh.edu (BRIAN STUART COSTELLO) writes:
- >If anyone knows of any routines that would allow variable record sizes in a
- >file, please tell me.
- >
- >What's I'd like is the ability to enter in text of any size (up to, say, 20k),
- >and when I wrote it to disk, I don't want the record to take up 20k if I
- >entered in 1k's worth.
-
- Use streams. You can either put the data in an object, and use the
- Put and Get methods from TStream, or just Read and Write it if you don't
- want to bother with objects.
-
- A poor alternative, which you'll be stuck with if you're not using TP 6+
- (5.5+, actually, if you trust demo code), is to use BlockRead and BlockWrite.
- Streams are better: they're at least as fast, less error-prone, and
- much more flexible.
-
- The biggest disadvantage to using streams is the documentation: Chapter 8
- of the Turbo Vision guide misleads you into thinking that streams are only
- good for objects. In fact, they're good, general purpose random access
- binary files.
-
- Duncan Murdoch
- dmurdoch@mast.queensu.ca
-