Charles,
> is there a way to have the strNPrintF example to get a length
> of the args added into the formated string before writing it?
Don't think so.
> ... pose it complains that the buffer is to small and writes
> to data structures ...
As someone has pointed out previously, POSE will continue to complain every
time the formatted string is longer than "size" because you are using
StrVPrintF() to write to a chunk that is only "size" bytes long.
Try changing "text=MemPtrNew(size);" to "text=MemPtrNew(256);" (or some
number that is comfortably larger than the biggest string printf() is likely
to produce).
> or is it possible to have it start writing to the buffer
> but stop at the specified length
Wasn't this the problem you were originally trying to get around?
Regards, Nick
-----Original Message-----
From: Charles Rezsonya [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 8 January 2000 2:32
To: [EMAIL PROTECTED]
Subject: Re: StrPrintF
is there a way to have the strNPrintF example to get a length of the args
added into the formated string before writing it? i ask this because when i
run the example in pose it complains that the buffer is to small and writes
to data structures or something (some error). or is it possible to have it
start writing to the buffer but stop at the specified length?
heres what i have so far....
/***********************************************************************/
Boolean StrNPrintF(CharPtr s, UInt size, CharPtr formatStr, ...) {
// Char text[size];
Int i, j, k, l, m;
Boolean failed;
Char *text;
va_list args;
va_start(args, formatStr);
i=sizeof(formatStr); ///
j=sizeof(args); ///
k=StrLen(formatStr);
l=StrLen(args);
text=MemPtrNew(size);
StrVPrintF(text, formatStr, args);
...