[Gambas-user] what is ... in c external function?

vuott at tiscali.it vuott at tiscali.it
Thu Jun 14 00:38:26 CEST 2018


  
...or you can specify it. 

Library "libc:6"

' int sprintf (char
*__restrict __s, const char *__restrict __format, ...)
' Write formatted
output to S.
Private Extern sprintf(__s As Pointer, __format As String,
f As Float) As Integer

Public Sub Main()

 Dim p As Pointer
 Dim s As
String

 p = Alloc(SizeOf(gb.Byte), 11)

 sprintf(p, "%f", 123.456789)


s = String@(p)

 Print s

 Free(p)

End

Il 13.06.2018 20:38 Jussi
Lahtinen ha scritto: 

> It means the same as in Gambas. IE undefined
amount of arguments. I have never run into this while using external
functions. 
> You can try: 
> Public Extern errx(status As Integer,
format as Pointer, ...) 
> ...but I have n clue whether it actually
works. The implementation may not be compatible with C. 
> Jussi 
> 
>
On Wed, Jun 13, 2018 at 8:09 PM, Demosthenes Koptsis wrote:
> 
>>
Hello,
>> 
>> i have the next external function in libc
>> 
>> 'void
errx (int status, const char *format, …)
>> 
>> what is the ... ?
>> 
>>
is this correct?
>> 
>> Public Extern errx(status As Integer, format as
Pointer)
>> 
>> Thnaks!
>> 
>> ----[ Gambas mailing-list is hosted by
https://www.hostsharing.net [1] ]----
  


Con Mobile Open 6 GB hai 6 Giga, 600 minuti e 300 SMS per il tuo smartphone a 9€ al mese per sempre. Passa ora a Tiscali Mobile, il nostro mese è vero! http://tisca.li/Open6GB0318

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20180614/15189187/attachment.html>


More information about the User mailing list