🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #5793

Re: Text or data files?

#5793
From: Brandon S. Allbery
Date: Sun, 02 Oct 1988 17:29
24 lines
1757 bytes
As quoted from <3958@enea.se> by sommar@enea.se (Erland Sommarskog):
+---------------
| Uh? If you have a text file and change the format you have to rewrite
| the parsing and the writing-to file parts. With a fixed format you
| change the declaration, and that's all. (Well, you may have to write 
| a simple program to convert old files, but you have do to that for 
| text files too.)
+---------------

The last time I added a field to the UNaXcess userfile I added a ":%s" to
the fprintf() write and a "getfld(buf,var)" to the read.  Trivial.  And
because of the way getfld() is written and the fact that new fields always
go at the end of the line (record), the userfile is self-upgrading:  if the
field is missing, a default value is used and the field is added on output.
Try THAT with a binary file!

As for newlines in "records", etc.:  there is a backslash-escape convention
that deals with this quite well.  But I rarely, if ever, find a need to
store newlines in data records.
-- 
Brandon S. Allbery, uunet!marque!ncoast!allbery			DELPHI: ALLBERY
	  For comp.sources.misc send mail to <backbone>!sources-misc
comp.sources.misc is moving off ncoast -- please do NOT send submissions direct
ncoast's days are numbered -- please send mail to ncoast!system if you can help
Technical Details
Message-ID: <12638@ncoast.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cwjcc!hal!ncoast!allbery
References: <3958@enea.se>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cwjcc!hal!ncoast!allbery
From: allbery@ncoast.UUCP (Brandon S. Allbery)
Newsgroups: comp.lang.misc
Subject: Re: Text or data files?
Message-ID: <12638@ncoast.UUCP>
Date: 2 Oct 88 17:29:19 GMT
References: <3958@enea.se>
Reply-To: allbery@ncoast.UUCP (Brandon S. Allbery)
Followup-To: comp.lang.misc
Organization: Cleveland Public Access UN*X, Cleveland, Oh
Lines: 24