
String to ASCII

MatLey
I wuold like to convert a string of characters in ASCII values.
So I made a function using SSCANF:
Function/S str2ASCII(tmpstr) String tmpstr String tmpASCII Variable i=0, tmp, num=strlen(tmpstr) For (i=0;i<num;i+=1) sscanf tmpstr[i], "%c", tmp tmpASCII+=num2str(tmp) endfor return tmpASCII End
So I check the function and It works. When I use the function:
String test String test2 test2="Hello" test=str2ASCII(test2)
"Attempt to use a null string variable" appears and this message "Missing text resource for error: 0" appears on the command line.
Where is the error? Because If I add print command in the function, a right result appears.
Thanks in advance.
Matteo
which gives
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
June 27, 2012 at 08:11 am - Permalink
June 27, 2012 at 08:36 am - Permalink
Matteo
June 28, 2012 at 12:17 am - Permalink