NAME

BUFF_GET_TOKEN - (MACRO) Sets up call to get_token

SYNOPSIS

#include "l/l_parse.h"

Example compile flags (system dependent):
  -DLINUX_X86_64 -DLINUX_X86_64_OPTERON  -DGNU_COMPILER 
   -I/home/kobus/include
   -L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
  -lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw 


size_t BUFF_GET_TOKEN
(
	const char **input_pos_ptr,
	char output_string[ ]
);

DESCRIPTION

The max_len parameter is set to sizeof(output_string). Using sizeof to set the buffer size is recomended where applicable, as the code will not be broken if the buffer size changes. HOWEVER, neither this method, nor the macro, is applicable if line is NOT a character array. If line is declared by "char *line", then the size of line is the number of bytes in a character pointer (usually 4), which is NOT what is normally intended. You have been WARNED! This macro is the same as BUFF_CONST_GET_TOKEN() except that it should be used when the argment is declared as (char**). Choosing the appropriate macro between BUFF_GET_TOKEN() and BUFF_CONST_GET_TOKEN() is prefered over casting. | The macro BUFF_GET_TOKEN_OK expands to:
            ( BUFF_GET_TOKEN(...) != NO_MORE_TOKENS )

EXAMPLE
    char line[ GOOD_STRING_SIZE ];
    char token[ GOOD_STRING_SIZE ];
    char *line_pos;

    // ....
    //   CODE TO GET "line"
    // ....

    line_pos = line;

    while (BUFF_GET_TOKEN_OK(&line_pos, token))
    {
        kjb_fprintf(stdout,"Token: %s\n",token);
    }
    kjb_puts(stdout,"All done.\n");

    // Here, if the line was set to "A B C" by the CODE TO GET
    // "line", then this example would output:
    //     Token: A
    //     Token: B
    //     Token: C
    //     All done.
    //
    // (It is worthwhile understanding this example if the L
    //  parsing routines are to be used.)

RELATED get_token, const_get_token, gen_get_token, const_gen_get_token, match_quote_get_token, const_match_quote_get_token, gen_match_quote_get_token, const_gen_match_quote_get_token, match_get_token, const_match_get_token, gen_match_get_token, const_gen_match_get_token, gen_get_last_token

DISCLAIMER

This software is not adequatedly tested. It is recomended that results are checked independantly where appropriate.

AUTHOR

Kobus Barnard

DOCUMENTER

Kobus Barnard

SEE ALSO

BUFF_GET_TOKEN_OK , BUFF_CONST_GET_TOKEN , BUFF_MQ_GET_TOKEN , BUFF_CONST_MQ_GET_TOKEN , BUFF_MATCH_GET_TOKEN , BUFF_CONST_MATCH_GET_TOKEN , BUFF_GEN_GET_TOKEN , BUFF_CONST_GEN_GET_TOKEN , BUFF_GEN_MQ_GET_TOKEN , BUFF_CONST_GEN_MQ_GET_TOKEN , BUFF_GEN_MATCH_GET_TOKEN , BUFF_CONST_GEN_MATCH_GET_TOKEN , BUFF_GEN_GET_LAST_TOKEN , BUFF_GEN_GET_LAST_TOKEN_2 , BUFF_GEN_SPLIT_AT_LAST_TOKEN , BUFF_GEN_SPLIT_AT_LAST_TOKEN_2