where is the memory corruption?

Виталий Фадеев vital.fadeev at gmail.com
Thu Dec 10 09:39:24 UTC 2020


On Wednesday, 9 December 2020 at 20:35:21 UTC, Jack wrote:
> I'm on linux/opensuse, trying to pass a wchar_* from C to D but 
> I'm getting only the first letter of that string. Could someone 
> help figure out why?
>
> [...]


May be this help to you:

	auto s2 = to!string(s);
to
	auto s2 = fromWChar( s );

wstring fromWChar( const wchar* s )
{
     import std.conv : to;
     return s[ 0 .. wcslen( s ) ].to!wstring;
}


Example: https://run.dlang.io/is/PkCeTZ


More information about the Digitalmars-d-learn mailing list