Page 1 of 1

C code translation

Posted: Wed Mar 16, 2016 2:02 pm
by callroot

Code: Select all


char *_i64toa(
   __int64 value,
   char (&str)[size],
   int radix 
);

char buf[64];
_i64toa(12345678,buf,10) //RETURN "12345678"
_i64toa(12345678,buf,2)//RETURN   "101111000110000101001110"

Code: Select all

ImportC "MSVCRT.LIB" 
  _i64toa(a.q,b.s,c) As "__i64toa"
 EndImport 

Code: Select all

'error code

 p1.l=10
 
 c.s{10}
 
 _i64toa(12345678,c,p1)

Who can translate I will be very grateful

Re: C code translation

Posted: Wed Mar 16, 2016 2:15 pm
by Keya
hello, you nearly had it, and at least you gave it a try! you just needed to pass the string by reference/pointer, something like this (compile without Unicode) -

Code: Select all

ImportC "MSVCRT.LIB"
  _i64toa(a.q,*b,c) As "__i64toa"
EndImport 

 p1.l=10
 c.s{10}
 _i64toa(12345678,@c,p1)
 
Debug c

Re: C code translation

Posted: Wed Mar 16, 2016 3:24 pm
by callroot
Keya wrote:hello, you nearly had it, and at least you gave it a try! you just needed to pass the string by reference/pointer, something like this (compile without Unicode) -

Code: Select all

ImportC "MSVCRT.LIB"
  _i64toa(a.q,*b,c) As "__i64toa"
EndImport 

 p1.l=10
 c.s{10}
 _i64toa(12345678,@c,p1)
 
Debug c
thank you