Managing error strings in C

Stan Brown browns at iccgcc.decnet.ab.com
Tue Jan 15 01:16:44 AEST 1991


In article <2779.278d8741 at iccgcc.decnet.ab.com> I wrote:
   [scheme of storing messages in an external file]

In article <645 at caslon.cs.arizona.edu>, dave at 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 at ab.com
Stan Brown, Oak Road Systems, Cleveland, Ohio, USA    +1 216 371 0043



More information about the Comp.lang.c mailing list