Hi all, I am using the following code to import data from a csv file to my table:
* NOTE: all this function does is grab all the data between quotes, ie. the fields.
c = ""
do while c <> '"' and !feof(f_hand)
c = fread( f_hand, 1)
enddo
temp_str = ""
c = ""
do while c <> '"' and !feof(f_hand)
c = fread( f_hand, 1)
if c <> '"' then
temp_str = temp_str + c
endif
enddo
If the csv file does not contain enough data to populate all the fields of my table then it reads each of the 4 characters which make up the crc checker (at the end of my csv file) to populate any remaining fields in my table until the feof function is reached. I did not implement the crc checker but can see that each csv file created contains 4 characters which makes up the crc value. I was thinking therefore if I could add a check along side the feof function to only read from the file handle if we have not reached the 4th character to the right of the csv file. Do you think this is a sure and safe way of controlling this situation and if so does anyone know i can control this???
* NOTE: all this function does is grab all the data between quotes, ie. the fields.
c = ""
do while c <> '"' and !feof(f_hand)
c = fread( f_hand, 1)
enddo
temp_str = ""
c = ""
do while c <> '"' and !feof(f_hand)
c = fread( f_hand, 1)
if c <> '"' then
temp_str = temp_str + c
endif
enddo
If the csv file does not contain enough data to populate all the fields of my table then it reads each of the 4 characters which make up the crc checker (at the end of my csv file) to populate any remaining fields in my table until the feof function is reached. I did not implement the crc checker but can see that each csv file created contains 4 characters which makes up the crc value. I was thinking therefore if I could add a check along side the feof function to only read from the file handle if we have not reached the 4th character to the right of the csv file. Do you think this is a sure and safe way of controlling this situation and if so does anyone know i can control this???