Latest revision as of 20:54, 11 May 2012

When displaying floats, for example, you can tell ROBOTC how many decimals places to display. This is standard across all 'C' - like programing languages. For example, if your float is PI(3.14159265), but you only want to dispay "3.14", your string should contain, "%1.2f".

The number before the decimal is how many digits before the decimal you wish to display, while the number after the decimal is how many digits after the decimal you wish to display. So "%1.2f" tells us to display one digit before the decimal and two digits after the decimal, with "3.14" as the final result.
|-
|}

Contents

strcat

void strcat(void &pToBuffer, const void &pFromBuffer)

(void) Function concatenates pFromBuffer onto end of pToBuffer. The variables are arrays of bytes terminated with zero character. It is user responsibility to ensure that the 'To' array is large enough to hold the result. ROBOTC is not able to do any range checking! Identical to the function found in conventional C 'string.h' library.

strcmp

short strcmp(void &pString1, const void &pString2)

(short) Function compares pString1 with pString2. Returns negative value if less than, 0 if equal and positive value if greater than. The variables are arrays of bytes terminated with a zero char. Identical to the function found in conventional C 'string.h' library.

strcpy

void strcpy(void &pToBuffer, const void &pFromBuffer)

(void) Function copies pFromBuffer to pToBuffer. The variables are arrays of bytes terminated with a zero character. It is user responsibility to ensure that the 'To' array is large enough to hold the result. ROBOTC is not able to do any range checking! Identical to the function found in conventional C 'string.h' library.

strncat

(void) Function concatenates pFromBuffer onto end of pToBuffer. The variables are arrays of bytes terminated with a zero character. nMaxBufferSize is the maximum size of ‘pFromBuffer’ and is usually created with a sizeof(..) function call. Identical to the function found in conventional C 'string.h' library file.

strncmp

(short) Function compares pString1 with pString2. Returns negative value if less than, 0 if equal and positive value if greater than. The variables are arrays of bytes terminated with a zero char. nMaxBufferSize is the maximum number of bytes to compare and is usually created with a sizeof(..) function call. Identical to the function found in conventional C 'string.h'