C4 Engine
C4 Engine API Documentation

Text::ReadString

Defined in:  TSText.h
Reads a string of non-whitespace characters from a character string.
Prototype

int32 ReadString(const char *text, char *string, int32 max);

Parameters
text A pointer to a character string.
string A pointer to a buffer that will receive the read characters.
max The maximum length of a string that can be stored in the buffer specified by the string parameter.
Description
The ReadString function reads a sequence of non-whitespace characters from the string specified by the text parameter and returns the number of characters that were read. The characters composing the string are stored in the buffer specified by the string parameter. The maximum number of characters returned in this buffer is specified by the max parameter. The buffer specified by the string parameter should be large enough to hold max characters plus a zero terminator.

If the first character pointed to by the text parameter is not a double quote, then the ReadString function reads characters until it encounters a whitespace character as defined in the description of the Data::GetWhitespaceLength function. If the first character is a double quote, then the ReadString function reads all of the characters between the first double quote and a closing double quote, including any whitespace. (The quotes themselves are not returned in the buffer pointed to by the string parameter.) Any quote preceded by a backslash is not considered a closing quote, but is instead included in the returned string without the backslash character.