internal structure of char[]

Bjoern nanali at nospam-wanadoo.fr
Fri Jan 18 04:17:46 PST 2008


Hi,
Does somebody know the internal structure of char[]   ?

Not only that I have to do a lot of converting on the DLL (D) side, I 
also have to convert the strings on the parrent side (4GL)

I hope I can use this info to simplyfy for example code like this :

alias extern(Windows) void function(char* token, size_t siz = 0) 
DisplayCallBack;

export extern(Windows)
bool TextDelimit(DisplayCallBack cb, char* source, char* delim)
{
	char[] _source = source[0 .. strlen(source)].dup;
	char[] _delim = delim[0 .. strlen(delim)].dup;

	// split into an array
     char[][] elements = Text.delimit (_source, _delim);
     foreach (char[] element; elements)
	{
		char* s = element.ptr;
		cb(s, strlen(s));
	}
	return true;
}

Well it works fine, but I want it smarter (if possible)
Thanks in advance, Bjoern


More information about the Digitalmars-d-learn mailing list