String to ASCII
| MatLey | June 27, 2012 - 06:55 | ||
|---|---|---|---|
|
Hi at All, 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 |
|||

Joined: 2007-08-14
Location: United States
Try this
which gives
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
Joined: 2007-06-21
Location: United States
Here is a solution that does not use sscanf:
Joined: 2012-06-19
Location: Spain
Thanks!
Matteo