Converting a string to char array gets me ascii numbers

 

I'm trying to convert a string into a char[], in order to write a file using WriteFile from kernel32.dll.


string writethis = "abc";
int lineSize = StringLen(writethis);
uchar line[];        
   
ArrayResize(line, lineSize);
StringToCharArray(writethis, line, 0, -1);

Happens that, this gives me an array o ASCII numbers line in the attached screen shot.

This doesn't happen if I explicitly define values for each char array position, like:


char charArray[3];
charArray[0] = "a";
charArray[1] = "b";
charArray[2] = "c";


What exactly I'm doing wrong? How I manage to get a proper array of characters from a string?

 

Forum on trading, automated trading systems and testing trading strategies

Converting a string to char array gets me ascii numbers

Matheus Hernandes, 2023.01.31 03:24

char charArray[3];
charArray[0] = 'a';
charArray[1] = 'b';
charArray[2] = 'c';