Processing Tokens

Processing Tokens - 9: Processing Tokens char *strtok(char...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
9: Processing Tokens char *strtok(char *str, const char *sep); separates str into tokens, using characters from sep as separators. The first parameter str may be NULL (but not in the first call). The first call takes the non-null first parameter, and returns a pointer to the first token (skipping over all separators)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
9: String-to-number Conversions double strtod(const char *s, char **p); long strtol(const char *s, char **p, int base); unsigned long strtoul(const char *s, char **p, int base); Convert a string s to a number. If the conversion failed:
Background image of page 2
9: Module for String Tokenizing Files often store data records using a delimited format; e.g. name|salary|id Here, the first field is a string, the second is a double, and the third is a long integer. For example:
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
9: Interface of module token int construct_Token(const char *str, const char *delimiters); int destruct_Token(void); int hasMore_Token();
Background image of page 4
9: Application of module token
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/18/2012 for the course CS 240 taught by Professor Rego during the Fall '08 term at Purdue University.

Page1 / 10

Processing Tokens - 9: Processing Tokens char *strtok(char...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online