    private static String readCString(MemorySegment ptr, long byteLen) {
        if (ptr == null || ptr.address() == 0) {
            return null;
        }
        return ptr.reinterpret(byteLen + 1).getString(0);
    }
