News for hackers. Stuff that matters.
Re:C Strings and my slow descent to madness by t43562 on Thursday April 06, 2023 @11:27AM (#35469666)
A long time ago my solution was ptr+len but I allocated 1 more byte so that if a string had to be given to libc, I could terminate it at that time. No need for a copy then.
Re:C Strings and my slow descent to madness by wvenable on Thursday April 06, 2023 @12:32PM (#35470795)
BASIC strings in Windows -- you store the length in the 4 bytes before the pointer to the string and put a null terminator at the end.

https://learn.microsoft.com/en-us/previous-versions/windows/...