See below

      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 is a char *, and strsize is long int.
There is a trailing null, as shown below.

       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.

Sorry about the line loc=source. Just delete it, it was an erroneous copy and paste.

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

void showProblem() {
        MemHandle h;
        long int strsize;
        char * loc;

        h = DmGet1Resource('tSTR', 2000);
        strsize = MemHandleSize(h); //Yields incorrect value ~ 288628
        loc = MemHandleLock(h);
        strsize = StrLen(loc); //Also gives the same wrong value
        strsize = 0;
        while (*loc != 0) strsize ++; loc++;} //Gives correct value of 3283
}
        



--
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to