core :: Text :: to_cstring
# Return a null terminated char *
fun to_cstring: CString is abstract
lib/core/text/abstract_text.nit:143,2--144,36
redef fun to_cstring: CString do
var cself = new CString.nul
var required_length = uchar_string.to_cstring(cself, 0, code_units)
cself = new CString(required_length + 1)
uchar_string.to_cstring(cself, required_length + 1, code_units)
return cself
end
lib/core/text/u16_string.nit:104,2--112,4
redef fun to_cstring do
var len = _byte_length
var ns = new CString(len + 1)
ns[len] = 0
var off = 0
for i in substrings do
var ilen = i._byte_length
i.as(FlatString)._items.copy_to(ns, ilen, i.as(FlatString)._first_byte, off)
off += ilen
end
return ns
end
lib/core/text/ropes.nit:91,2--102,4
redef fun to_cstring do
var blen = _byte_length
var new_items = new CString(blen + 1)
_items.copy_to(new_items, blen, _first_byte, 0)
new_items[blen] = 0
return new_items
end
lib/core/text/flat.nit:420,2--426,4