strtok
Syntax
Defined in
Description
Example
tan
Syntax
Defined in
Description
Example
Break String Into Token
#include <string.h>
char *strtok(char *str1, const char *str2 );
strtok.c in rts.src
Successive calls to the strtok function break str1 into a series of tokens, each
delimited by a character from str2. Each call returns a pointer to the next token.
The first call to strtok uses the string str1. Successive calls use a null pointer
as the first argument. The value of str2 can change at each invocation. It is im-
portant to note that str1 is altered by the strtok function.
After the first invocation of strtok in the example below, the pointer stra points
to the string excuse\0 because strtok has inserted a null character where the
first space used to be. In the comments, the notation \0 represents the null
character.
char *stra = "excuse me while I kiss the sky";
char *ptr;
ptr = strtok (stra," "); /* ptr −−> "excuse\0" */
ptr = strtok (0," ");
ptr = strtok (0," ");
Tangent
#include <math.h>
double tan(double x );
tan.c in rts.src
The tan function returns the tangent of a floating-point number x. The angle
x is expressed in radians. An argument with a large magnitude may produce
a result with little or no significance.
double x, y;
x = 3.1415927/4.0;
y = tan(x);
/* ptr −−> "me\0"
/* ptr −−> "while\0"
/* return value = 1.0 */
Run-Time-Support Functions
tan
*/
*/
7-57
Need help?
Do you have a question about the TMS320C2x and is the answer not in the manual?