blob: 7b2f092304a0f34a27905a33f187fe4788854aee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
new_c_string :: proc(s: string) -> ^byte {
c := new_slice(byte, s.count+1);
copy(c, cast([]byte)s);
c[s.count] = 0;
return c.data;
}
to_odin_string :: proc(c: ^byte) -> string {
s: string;
s.data = c;
for (c+s.count)^ != 0 {
s.count++;
}
return s;
}
|