Hi Larry, >Since > >X%=&7FFF >XX&=X%+X%+X%+X% >? X& Do you mean ? XX&? > >yields what it should, it seems to me that by the same token > >X$=STRING("X", 250) I think you mean X$=STRING(250, "X") >XX$$=X$+X$ >? XX$ > >should yield a container ($$) of 500 characters X. It runs into an error adding the 2 strings, which is the reason for my FNs. > >Jay's function FN meldStrs didn't work for me until >I wiggled it a bit. Maybe it just got damaged in >transit. I'm curious. I copied it back out of the email and ran it with nary a problem. What didn't work for you? >The thing that got me on track was the >observation in the manual that @s$$ is not a handle >but rather a pointer to a handle, a "grip". Good point, but you seem to imply that this makes a difference to my code??? I have some questions about your proposed changes: >LOCAL >DIM csr&, size&, SumPtr& >LOCAL FN weldStrs(SumHndl&,S1&,S2&,S3&,S4&) Why introduce "Sum" into var names? This fn is explicitly for handling text--the only "sum" is in the size var. >/* >Jay Reeve 14 Aug 2001; Larry S., 15 Aug >*/ >size& = S1&.0`` +S2&.0`` +S3&.0`` +S4&.0`` >if SumHndl& = 0 then SumHndl&=FN NEWHANDLE(0) >call SETHANDLESIZE (SumHndl&,size&) >if SumHndl& = 0 then stop "Can't create temp handle in FN weldStrs" Why do you call this a temp handle? I see nothing temporary about it. We are preempting the runtime's creation of a (semi-permanent) handle for the container. >CALL HLOCK(SumHndl&): SumPtr& = [SumHndl&] >csr& = SumPtr& Does this preliminary dereferencing really save that much time? It's not a bad idea, but why not go directly to csr& rather than through sumPtr&?: csr& = [SumHndl&] >IF S1&.0` then BLOCKMOVE(S1&+1, csr&, S1&.0``) : csr& += S1&.0`` >IF S2&.0` then BLOCKMOVE(S2&+1, csr&, S2&.0``) : csr& += S2&.0`` >IF S3&.0` then BLOCKMOVE(S3&+1, csr&, S3&.0``) : csr& += S3&.0`` >IF S4&.0` then BLOCKMOVE(S4&+1, csr&, S4&.0``) >CALL HUNLOCK(SumHndl&) >END FN > >of which a typical call is: > >DIM s$$ >DIM a$,b$,x$,y$,z$,w$ >' >a$ = String$(120,"a") >b$ = String$(150,"b") >x$ = String$(150,"x") >y$ = String$(150,"y") >z$ = String$(150,"z") >w$=" DONE!" >' >FN weldStrs([@s],@x$,@y$,@z$,@w$) Why take the addresses here, complicating (for the programmer) every call to the FN, rather than once in the FN? Notice that the way I did it could handle both string vars and literals, including null strings (""), which is necessary for the ease of use Michael was looking for. (I understand this won't work for him, but it may be of use to someone.) >? s$$ >? LEN(s$$) Did anyone else find problems in the code I posted? (Jonathan, you talked about "debugging" it--??) I confess I omitted an important error check after resizing the handle, but otherwise it seems to work perfectly here. 0"0 =J= a y "