Creates temporary 0-terminated C string with copy of passed text.
version (Posix) { import core.stdc.stdlib : free; import core.sys.posix.stdlib : setenv; import std.exception : enforce; void setEnvironment(scope const(char)[] name, scope const(char)[] value) { enforce(setenv(name.tempCString(), value.tempCString(), 1) != -1); } } version (Windows) { import core.sys.windows.winbase : SetEnvironmentVariableW; import std.exception : enforce; void setEnvironment(scope const(char)[] name, scope const(char)[] value) { enforce(SetEnvironmentVariableW(name.tempCStringW(), value.tempCStringW())); } }
Denis Shelomovskij 2013-2014
Helper functions for working with C strings.
This module is intended to provide fast, safe and garbage free way to work with C strings.