Finding Available Length Of Strings...
Karl Heuer
karl at ima.isc.com
Sat Nov 10 05:39:57 AEST 1990
In article <16758 at hydra.gatech.EDU> gt4512c at prism.gatech.EDU (BRADBERRY,JOHN L) writes:
>Just a note of clarification here...I am talking about a character array
>and I am looking for a solution (not the obvious '...add another length
>parameter')...I would like the function to be able to 'figure it out!'
Here are the options that spring to mind:
(a) Pass a length parameter.
(b) Pass a pointer to the end of the string.
(c) Implement a string structure that does one of the above for you, e.g.
typedef struct { char *start; char *current; char *end; } string_t;
(d) Use only implementations that support the "Read Operator's Mind" syscall.
Next question?
Karl W. Z. Heuer (karl at ima.isc.com or uunet!ima!karl), The Walking Lint
More information about the Comp.lang.c
mailing list