Return a null terminated char *

Property definitions

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

core $ U16String :: to_cstring
	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

core $ Concat :: to_cstring
	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

core $ FlatString :: to_cstring
	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

core $ FlatBuffer :: to_cstring
	redef fun to_cstring
	do
		var bln = _byte_length
		var new_native = new CString(bln + 1)
		new_native[bln] = 0
		if _length > 0 then _items.copy_to(new_native, bln, 0, 0)
		return new_native
	end
lib/core/text/flat.nit:1018,2--1025,4