$INCLUDE "windowssdk.inc" $include "stdio.inc" FILE oFile,iFile ISTRING output[1024],indata[1024] INT iRecs=0 int WordCount = 0 int a = 0 string Words[10,100] int MaxWords[10] istring Copy[255] OPENCONSOLE print path = GETSTARTPATH ifilename = path + "input.txt" IF OPENFILE(iFile,ifilename,"R") = 0 IF OPENFILE(oFile,"output.txt","W")=0 do READ(iFile,indata) copy = indata 'Must make a copy of the string first! as original string gets destroyed.... iRecs++ print indata print pointer token = strtok(indata,"\t\n,|\"") WHILE token PRINT *token 'Our word..... int Pos = (token-&indata) ' &indata = pointer to indata, token = pointer to indata + offset. if Pos 'Our delimiter position. print "Delimiter is at position ",Pos," and it is this -->",mid$(Copy,Pos,1),"<--" endif WordCount ++ Words[iRecs,WordCount] = *token token = strtok(NULL,"\t\n,|\"") ENDWHILE print MaxWords[iRecs] = WordCount WordCount = 0 WRITE oFile,output output="" until EOF(iFile) ENDIF ENDIF CLOSEFILE oFile CLOSEFILE iFile for a = 1 to iRecs for b = 1 to MaxWords[a] print Words[a,b] next b print next a print "Lines = ",iRecs DO:UNTIL INKEY$ <> "" CLOSECONSOLE