Help needed with Lattice C

comcon morgan at comcon.UUCP
Wed Dec 6 18:56:33 AEST 1989


In article <21014 at unix.cis.pitt.edu>, whbst at unix.cis.pitt.edu (William H Broadley) writes:
> 
> 	I am porting NSCA Telnet into Microsoft C 5.1, and after close 
> Examination of the MSC manuals, I can't figure out what the following command
> do in Lattice 3.x.  Any help would be appreciated.
> 	
> 	Stptok (ptr,ptr,#,string of tokens)
> 	strtok (str,string of tokens)
> 	stpblk (ptr)


	Don't know how much it's changed, but this is from Lattice 5.0

Stptok Get next token from a string.

p = stptok(s,tok,toklen,brk)

char *p;     points to next character after token
char *s;	points to input string
char *tok;	points to output buffer
int toklen;	sizeof(tok)
char *brk;	break string

This function breaks out the next token from the input string and moves it
to the token buffer with a null terminator. A token consists of all characters
in the input string s up to but not including the first character that is in
the break string. In other words, brk specifies the characters that cannot be
included in a token.

Returns a pointer to the next character in the input string.

strtok	Get a token

t = strtok(s,b);

char *t;	token pointer
char *s;	input string pointer or NULL
char *b;	break character string pointer

This function treats the input string as a series of one or more tokens seperated
by one or more characters from the break string. By making a sequence of calls
to strtok, you can obtain the tokens in left-to-right order. To get the first
(leftmost) token, supply a non-NULL pointer for the s argument. Then to get the
next tokens, call the function repeatedly with a NULL pointer for s, until
you get a NULL return pointer to indicate that there are no more tokens.

returns a NULL pointer when there are no more tokens.

stpblk	skip blanks (white space)

q = stpblk(p);

char *q;	updated string pointer
char *p;	string pointer

This function advances the string pointer past white space characters, that
is, past all the characters for which isspace is true.

returns a pointer to the next non white space character.

Courtesy of Lattice 5.0 manual

Hope this helps.

Morgan



-- 
Morgan M. Morgan  BITNET: TSMJM at ALASKA.BITNET  UUCP: uunet!comcon!morgan
                  CIS: 76164,3477
 "Remember....it don't mean shit to a tree!"



More information about the Comp.lang.c mailing list