mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-10 15:03:22 +00:00
Add strings.ptr_from_string
This commit is contained in:
@@ -41,7 +41,7 @@ del *.ilk > NUL 2> NUL
|
||||
|
||||
cl %compiler_settings% "src\main.cpp" ^
|
||||
/link %linker_settings% -OUT:%exe_name% ^
|
||||
&& odin run examples/demo/demo.odin
|
||||
&& odin build examples/demo/demo.odin -keep-temp-files
|
||||
|
||||
del *.obj > NUL 2> NUL
|
||||
|
||||
|
||||
@@ -42,6 +42,10 @@ string_from_ptr :: proc(ptr: ^byte, len: int) -> string {
|
||||
return transmute(string)mem.Raw_String{ptr, len};
|
||||
}
|
||||
|
||||
ptr_from_string :: proc(str: string) -> ^byte {
|
||||
d := transmute(mem.Raw_String)str;
|
||||
return d.data;
|
||||
}
|
||||
|
||||
unsafe_string_to_cstring :: proc(str: string) -> cstring {
|
||||
d := transmute(mem.Raw_String)str;
|
||||
|
||||
Reference in New Issue
Block a user