C code translation

Everything else that doesn't fall into one of the other PB categories.
callroot
User
User
Posts: 64
Joined: Sat Mar 05, 2016 10:46 pm

C code translation

Post 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
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: C code translation

Post 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
callroot
User
User
Posts: 64
Joined: Sat Mar 05, 2016 10:46 pm

Re: C code translation

Post 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
Post Reply