????? HELP!!! what is wring with this code? ???????

6607 ssa at mrsvr.UUCP
Fri Oct 7 09:00:59 AEST 1988


	For the life of me I can't figure out what is wrong with the following
	code!!!!  It is supposed to parse words from a string in which words
	are delimited by blanks or tabs, and print one word a line.  Simple
	right? well not quite.

	when I compile it I get a message:

"test.c", line 7: warning: illegal combination of pointer and integer, op =

	this of course referes to the line with the while loop.  When I run it
	the prompt just comes back, (I am not prompted to put in my string)

	and the funny part is when I run the same program in dbxtool (SUN WS)
	IT RUNS FINE !!!!!!!!

____________________________________________________________________________
#include <strings.h>
#define NULL (char *) 0
main()
{
	char buf[81];
	char *tokptr,*strptr=buf;
	gets (buf);
	while((tokptr=strtok(strptr," \t")) != NULL ){
		printf ("%s\n",tokptr);
		strptr=NULL;
	}
}
----------------------------------------------------------------------------


	So, what is wrong???

	Thanks in advance...

=======================================================================

      /         /| |   |\ \   | |
     /__       /_| |   |_\ \  | |     ...att!uwmcsd1!mrsvr!ssa
       /      /  | |   |  \ \ | |        (414) 547-9429
      / o    /   | |__ |   \ \| |        (414) 521-6607 (work)

=======================================================================



More information about the Comp.unix.questions mailing list