Re: StringToUCharArray
Your original code works fine in 19.1
All I have done is set the arg size big enough at the start
Code:
Procedure Test
UChar[] ucIn ucOut ucOut2
String sFile
Integer iSize1 iSize2 iSize3 iArgSize
Integer iChn
Handle oCharTranslate
Get Seq_New_Channel to iChn
// Direct_Input channel iChn ("binary:C:\Windows\System32\ntdll.dll") // 1.9 megabyte
// Direct_Input channel iChn ("binary:C:\Windows\System32\OpcServices.dll") // 2.1 megabyte
// Direct_Input channel iChn ("binary:C:\Windows\System32\win32kfull.sys") // 3.6 megabyte
Direct_Input channel iChn ("binary:c:\windows\explorer.exe") // 4.5 megabyte
Read_Block channel iChn ucIn -1
Close_Output channel iChn
Send Seq_Release_Channel iChn
Move (SizeOfArray(ucIn)) to iSize1
Get_Argument_Size to iArgsize
If (iSize1*1.4>iArgSize) Begin
Set_Argument_Size (iSize1*1.4)
End
Get Create (RefClass(cCharTranslate)) to oCharTranslate
Get Base64EncodeUCharArray of oCharTranslate ucIn to ucOut
Move (SizeOfArray(ucOut)) to iSize2
Move (UCharArrayToString(ucOut)) to sFile
Move (StringToUCharArray(sFile)) to ucOut
Get Base64DecodeUCharArray of oCharTranslate ucOut to ucOut2
Move (SizeOfArray(ucOut2)) to iSize3
Showln iSize1 " " iSize2 " " iSize3
If not (IsSameArray(ucIn,ucOut2)) Begin
Send Info_Box "Test Failed"
End
Set_Argument_Size iArgSize
Send Destroy of oCharTranslate
End_Procedure
Success consists of going from failure to failure without loss of enthusiasm - Winston Churchill