Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!abvax!iccgcc!browns From: browns@iccgcc.decnet.ab.com (Stan Brown) Newsgroups: comp.lang.c Subject: Re: Managing error strings in C Message-ID: <2802.279176fd@iccgcc.decnet.ab.com> Date: 14 Jan 91 14:16:44 GMT References: <1991Jan10.122227@lotus.lotus.com> <636@caslon.cs.arizona.edu> <2779.278d8741@iccgcc.decnet.ab.com> <645@caslon.cs.arizona.edu> Lines: 28 In article <2779.278d8741@iccgcc.decnet.ab.com> I wrote: [scheme of storing messages in an external file] In article <645@caslon.cs.arizona.edu>, dave@cs.arizona.edu (Dave P. Schaumann) writes: > Agreed. If you've got 50K of error messages, this is the way to go. A > refinement I would make is to make the error file random access, so the > whole file wouldn't have to be read in to get one message. Messages are of the form XKKNN, where NN is serial within XKK. A small program reads the message file, sorts it, and prepends the fseek( ) numbers for all the XKK values that occur. The real program reads the table in at the beginning of execution, then if it needs a message it randomly accesses XKK00 and reads sequentially from there. This means that only the message codes, not their locations, are compiled into the program. (The message file changes frequently during development.) > | 2. Messages can be translated to other languages without > |changing the program. > What about other program text? You wouldn't be able to take advantage of > this unless *all* of your messages were stored externally. Right. Actually all text _is_ in the file, but I mentioned only errors because that was the subject of the thread. BTW, the decimal point '.' is in the file because in some non-English languages that would be ','. Please do not attribute these remarks to any other person or company. email (I think): browns@ab.com Stan Brown, Oak Road Systems, Cleveland, Ohio, USA +1 216 371 0043