/* token3.c: Read comma-delimited fields */
#include <stdio.h>
#include <string.h>
main()
{
char s[81];
while (gets(s))
{
char *p, *sp = s;
int nchars;
do
{
/* Make p point at next comma, or '\0'*/
if ((p = strchr(sp,',')) == NULL)
p = sp + strlen(sp);
nchars = p - sp;
/* Print the field */
if (sp > s)
putchar(',');
printf("\"%.*s\"",nchars,sp);
/* Position at start of next field */
sp = p+l;
} while (*p ! = '\0');
putchar('\n');
}
return O;
}
/* End of File */