From C to D: issue with arguments for core.stdc.string.memcpy

Mike Parker aldacron at gmail.com
Wed Feb 20 20:57:26 UTC 2019


On Wednesday, 20 February 2019 at 20:46:42 UTC, Alec Stewart 
wrote:

>
> The error
>
>     onlineapp.d(42): Error: function 
> core.stdc.string.memcpy(return scope void* s1, scope 
> const(void*) s2, ulong n) is not callable using argument types 
> (char[31], const(char)*, ulong)
>     onlineapp.d(42):        cannot pass argument 
> (*s).stack.buffer of type char[31] to parameter return scope 
> void* s1
>
>
> SO, with all of that; how can I fix this? Do I have to do some 
> ugly type casting?
>

You're passing a static array where the function expects a 
pointer.

memcpy(s.stack.buffer.ptr, input, n);


More information about the Digitalmars-d mailing list