On Jan 19, 2008, at 9:33 AM, David Linker wrote:

> The handle is allocated, and I can even search for the end of the  
> string and get the right value for the length!
>
> I was originally planning to resize the string resource as I  
> modified it, but I can't do that if I don't know the correct length.  
> I suppose I could just be careful never to make it longer, and leave  
> the chunk the same size. I had hoped for a more elegant solution.
>
> Any ideas?
>
>
> Code example:
>       h = DmGet1Resource('tSTR', myString);
>        strsize = MemHandleSize(h);
>       // strsize = 288628, which is much too big

I've never seen this before, but I haven't tried to use MemHandleSize  
on a resource handle in ages, so it's possible NVFS devices have  
introduced some kind of weirdness there.

>        loc = MemHandleLock(h);
>        strsize = StrLen(loc);
>       //strsize = 288628 again wrong, but at least it is consistent!

This makes no sense at all, and suggests a bug with your code. Pilrc  
always puts the trailing nul on string resources, and StrLen should  
not fail like that. How is the strsize variable declared?

>        loc = source;
>        while (*loc != 0) {i++; loc++;}
>       // i=3283  this is the correct value

I can't comment on this because I don't know how the variable source  
got declared and assigned.

It would be better if you could post a complete, compilable code  
snippet, including all variable declaration and initialization.

-- 
Dave Carrigan
[EMAIL PROTECTED]
Seattle, WA, USA

Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to