Although I get the point that the 0’s are not counted for the cstring length, but are for the buffer link. I don’t understand this: var buffer = [byte('a'), byte('b'), 0, 0, 0] let cstr = cast[cstring](buffer[0].addr) doAssert cstr == "ab" # Why does buffer[0] give both `a` and `b`, not just a? Is buffer[0] not == to ‘a’? Run
I also don’t get how `ptr byte` goes to any of this. Is `buffer[0].addr` the same as the `buffer` var in my code? I was wondering how you could get a multi byte string from one `ptr byte` anyways. And @JiyaHana, idk how your code is supposed to work but it does not?