21052, "bmcdonald3", "[feature request] Convenience functions for 'c_ptr(c_char)'", "2022-11-17T17:56:40Z"
Given that c_ptr(c_char) is now being recommended over c_string due to the conversation in Should we deprecate c_string? · Issue #14215 · chapel-lang/chapel · GitHub, it would be nice to add the same convenience functions for c_ptr(c_char) that exist for c_string today. For example, I am able to cast a c_string to bytes today, like:
var chplStr = "My String";
var cStr: c_string = chplStr.c_str();
writeln(cStr:bytes);
so it would be nice if you could do something like that with c_ptr(c_char) (and just generally use it the same way as c_string), like:
var chplStr = "My String";
// doesn't work today, but mentioned in issue above
var cStr: c_ptr(c_char) = chplStr.c_str();
writeln(cStr:bytes);