I am using the FreeBasic compiler but I suspect that Qbasic techniques would also help me here.

My FB programs currently read in a CSV file that is approximately 300,000 rows by exactly 19 data items per row. I first use a Line Input routine to determine the number of rows and then read the file sequentially into memory where I then do manipulations and save as a new file.

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

i = 0

OPEN FILENAMECURRENT$ FOR INPUT AS #1

DO WHILE NOT EOF(1)

i = i + 1

LINE INPUT #1, OPTIONLINE$

CHAR1$ = LEFT$(OPTIONLINE$, 1)

IF CHAR1$ = "" THEN EXIT DO

LOOP

CLOSE #1

FINALROWNUMBER_MASTER% = i

OPEN FILENAMECURRENT$ FOR INPUT AS #1

FOR i = 1 TO FINALROWNUMBER_MASTER%

FOR j = 1 TO 19

INPUT #1, WorkingRawArray$(i, j)

NEXT

NEXT

CLOSE #1

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

My data vendor now tells me that due to extraneous events it is possible that some rows will have 19 items and some will have 20 items. I think I want to do the same line input routine to determine the number of rows but then read each line in one at a time. For rows with 19 items I will add an extra +",DUMMY" value at the end to cause all rows to be the same data item length. I can probably figure that part out myself.

My problem is what would be a good way to determine whether there are 19 or 20 data items in the row?

Any help would be appreciated.

Thanks

dbish