This is how I did it -Ken.
/*
String Split - Kvtech (filemaker plugin group) 11/20/2008
freeware private or commercial
extracts comma delimited strings
Note: modify main() so that you are passing an FHANDLE parm
i'm sure there are better ways to do this
however should work with any c/c++ compiler
Compile as a win console mode app to test
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <conio.h>
main()
{
int c,i,j,k,len,p;
char str [80]; /* local holding place for original parm */
char str1[80]; /* number of strings = number of parms*/
char str2[80];
char str3[80];
sprintf(str,"%s","Parm1,Parm2,Parm3");
/* str = entire parm string*/
len=strlen(str)+1; /* account for c's zero byte */
for (i=0; i<len; i++) { /* extract parm1 into
str1*/
str1[i]=str[i];
if ((str[i]==',') || (str[i]==0)) {
str1[i]=0;
break;
}
}
j=i+1; k=0; /* adjust pointer for next parm*/
for (i=j; i<len; i++) {
str2[k]=str[i]; /* extract parm2 into str2 */
k++;
if ((str[i]==',') || (str[i]==0)) {
str2[k-1]=0;
break;
}
}
j=i+1; k=0; /* extract parm3 into str3 */
for (i=j; i<len; i++) {
str3[k]=str[i];
k++;
if ((str[i]==',') || (str[i]==0)) {
str3[k-1]=0;
break;
}
}
printf("%s\n",str); /* original complte Parm string */
printf("%s\n",str1); /* parm1 */
printf("%s\n",str2); /* parm2 */
printf("%s\n",str3); /* parm3 */
// i = atoi(str3); /* if a parm was a num - convert it*/
// printf("%i\n",i);
getch();
}