ASC() Function in Unicode Executable

Just starting out? Need help? Post your questions and find answers here.
swhite
Enthusiast
Enthusiast
Posts: 726
Joined: Thu May 21, 2009 6:56 pm

ASC() Function in Unicode Executable

Post by swhite »

Hi

I am wondering whether the Asc() should have another parameter to force it to return ASCII when the program is compiled in Unicode. The reason is that I have a unicode executable that communicates with devices that send back ASCII text. I put the text into a memory buffer as ASCII but if I use the ASC() on that data the result is a Unicode value. I was naively expecting that it would return the ASCII value. I had to change my code to use PeekA() to get the expected result.

I guess I am wondering how best to handle ASCII text in a unicode executable.

Simon
Simon White
dCipher Computing
User avatar
skywalk
Addict
Addict
Posts: 3972
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: ASC() Function in Unicode Executable

Post by skywalk »

Send ascii text with:
*txt = Ascii(myPB$)

Read ascii text from outside with:
MyPB$ = PeekS(*txt, -1, #PB_Ascii)
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
swhite
Enthusiast
Enthusiast
Posts: 726
Joined: Thu May 21, 2009 6:56 pm

Re: ASC() Function in Unicode Executable

Post by swhite »

I guess I better upgrade my version of PB because I do not have that function.

Thanks,
Simon
Simon White
dCipher Computing
Post Reply