Back to main page

String buffer

The string buffer is a dynamic string that you can write to and read from like an array of 16-bit signed integers.

I have made it this way to make sure that the engine is compatible with many languages and safe from any pointer errors.

The index start counting from 1 like in Visual Basic.

Any method in the engine that require a string as input will take the string buffer as input.

Write to the string buffer and call the method immediatelly after to give it the argument. Making other calls in the middle may cause the string buffer to be filled with something else. Making wrapper functions will exclude the possibility of this and make the code easier to read.

Any method in the engine returning a string will write it to the string buffer. Make the call and read from the string immediatelly after to get the result.

int GetLengthOfStringBuffer(void);

Returns the number of characters in the string buffer. Null terminator is not included.

short int ReadFromStringBuffer(int Index);

1 <= Index <= number of characters in the buffer.

Returns a numeric value representing the Unicode character from the string buffer at Index.

How to get the string in pseudo code:

void SetLengthOfStringBuffer(int NewSize);

NewSize >= 0.

Makes sure that the string buffer is large enough to store the number of characters given by NewSize.

void WriteToStringBuffer(int Index, short int NewCharacter);

1 <= Index <= length of string buffer.

Writes the Unicode character represented by NewCharacter to the string buffer at Index.

How to set the string in pseudo code:

Methods in the engine using the string buffer includes "_InSB" or "_OutSB" to avoid confusion about input and output types. The only exception is the string buffer's own methods.