[Gambas-user] what is ... in c external function?
Demosthenes Koptsis
demosthenesk at gmail.com
Thu Jun 14 08:56:20 CEST 2018
yes thanks a lot all of you... it is the ellipsis as i found at
https://stackoverflow.com/questions/2735587/in-a-c-function-declaration-what-does-as-the-last-parameter-do
On 06/14/2018 01:38 AM, vuott at tiscali.it wrote:
> ...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
>> <demosthenesk at gmail.com <mailto:demosthenesk at gmail.com>> 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 ]----
>>
>
>
>
> 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
>
>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20180614/d49a4949/attachment.html>
More information about the User
mailing list