[OpenBIOS] Concatenating strings

Programmingkid programmingkidx at gmail.com
Wed Sep 1 02:06:16 CEST 2010


Could someone provide me with a code example on how to combine two strings together in forth please. Here is my attempt. For some reason it doesn't work. Any help would be great.

\ (addr len -- )

: loadLocalVariable 
dup
9 +
dup
>r
alloc-mem
" variable "
rot  
dup  
>r   
swap   
move   
r>			
r>
+		
swap 
3dup  
move
9      
+
dup   
>r
-   
r>   
eval
drop
;


All this code does this basically

sprintf(defineVariableCommandString, "variable %s", variableString);
feval(defineVariableCommandString);

Boy I love C. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20100831/c49fee57/attachment.html>


More information about the OpenBIOS mailing list