From efbc889a346ef46057d060a53001d64ad25552a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matheus=20C=2E=20Fran=C3=A7a?= Date: Sat, 6 Jan 2024 15:45:21 -0300 Subject: [PATCH] cStrtoD for betterC --- src/sokol/app.d | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sokol/app.d b/src/sokol/app.d index 41c9484..0f3cd70 100644 --- a/src/sokol/app.d +++ b/src/sokol/app.d @@ -3,9 +3,11 @@ module sokol.app; // helper function to convert a C string to a D string -string cStrTod(T)(scope T c_str) nothrow { - import std.conv: to; - return c_str.to!string; +string cStrTod(T)(inout(char)* c_str) nothrow { + auto start = c_str; + auto end = cast(char*) c_str; + for (; *end; end++){} + return cast(string) c_str[0 .. end - start]; } enum max_touchpoints = 8; enum max_mousebuttons = 3;