GetWord.c



char *doGetWord(char *buffer, char *word, int maxlen, BOOL comma)

Inputs

char *buffer Input buffer to read words from
int maxlen Max length of output word
BOOL comma Treat commas like white space?

Outputs

char *word Word read from buffer

Returns

char * Pointer to start of next word in buffer or NULL

Description

This code is designed to be called from GetWord() or GetWordNC()

Reads a whitespace delimted word out of buffer into word. If comma is TRUE, then commas are treated just like white space, otherwise they are treated like normal characters.

Words containing white space may be wrapped in double inverted commas. A \ is used as an escape character and maybe used to escape *any* following character. In particular: "\\" -> '\' To get a backslash "\ " -> ' ' To get a hard whitespace (alternatively wrap the string in double inverted commas) "\"" -> '"' To get a double inverted comma

Created: 10.06.99 Last Modified: 10.06.99


char *GetWord(char *buffer, char *word, int maxlen)

Inputs

char *buffer Input buffer to read words from
int maxlen Max length of output word

Outputs

char *word Word read from buffer

Returns

char * Pointer to start of next word in buffer or NULL

Description

This code is a wrapper to doGetWord()

Reads a whitespace/comma delimted word out of buffer into word.

Words containing white space may be wrapped in double inverted commas. A \ is used as an escape character and maybe used to escape *any* following character. In particular: "\\" -> '\' To get a backslash "\ " -> ' ' To get a hard whitespace (alternatively wrap the string in double inverted commas) "\"" -> '"' To get a double inverted comma

Created: 10.06.99 Last Modified: 10.06.99


char *GetWordNC(char *buffer, char *word, int maxlen)

Inputs

char *buffer Input buffer to read words from
int maxlen Max length of output word

Outputs

char *word Word read from buffer

Returns

char * Pointer to start of next word in buffer or NULL

Description

This code is a wrapper to doGetWord()

Reads a whitespace delimted word out of buffer into word. Commas are treated just like normal characters.

Words containing white space may be wrapped in double inverted commas. A \ is used as an escape character and maybe used to escape *any* following character. In particular: "\\" -> '\' To get a backslash "\ " -> ' ' To get a hard whitespace (alternatively wrap the string in double inverted commas) "\"" -> '"' To get a double inverted comma

Created: 10.06.99 Last Modified: 10.06.99