This is what i use to copy data from a String directly to a buffer, bypassing ToCString()
i really wish the String class could do this ;)
Then you could alternatively do this:
i really wish the String class could do this ;)
#include "E:\Program Files\BlitzMax\mod\brl.mod\blitz.mod\blitz_string.h" int CopyToCString( BBString *str, char *dst, int maxlen) { int i, sz; if( str->length+1 >= maxlen) sz = maxlen - 1; else sz = str->length; for( i=0; i<sz; i++) dst[i] = str->buf[i]; dst[sz] = 0; return sz; }
Then you could alternatively do this:
Function GetString:Int( buffer:Byte Ptr, maxlen:Int) Return CopyToCString( "Hello World!", buffer, maxlen) EndFunction