> >
> > You can use lowlevel as you do. Try using fgets() instead of fread() so you can loop line wise. There are alternatives which I prefer. If the text file is not very large:
> > 1) FileToStr("myFile.csv") reads the file in a string variable and you could get the lines using alines() or memlines().
> > 2) You could create a cursor and do an "append from type delimited" - or csv but delimited is preferable.
> > Both operate very fast. If your csv file would invariably conain some data per line that you can differentiate (ie: in csv you get something like orderNo, productId whatever that may serve as a row identifier) then you could use a "for" clause with "append from" and directly get the line(s) you need.
> >
> > The best strategy depends on file content, size etc.
> >
> > Cetin Basoz
> >
> >
.Net has got better.Think about moving - check my blog:
> >
Blog (main)> >
Blog (mirror)>
>
>
> Thanks for that
>
> ok I will try fgets(), but how to get record pointer to last line is my problem
> not sure how to do this
> i can move to end of file, but not start of last line to read in (n) bytes for example
> Phillipe
Probably I wasn't clear enough. What I suggest is other two methods. You might however do with lowlevel too. Simply create a loop and fgets(). Last fgets() is the last one. You may directly
fseek( m.lnHandle, 8192+1, 2)
and start looping from there. If there is a chance that your lines might be over 8192 bytes than use fread(). Again fseek() from eof but this time 65535.
Anyway what would you do with these "lines"? Probably you need to prefer 2nd method - append from. It is almost always the best CSV parser.
Cetin Basoz
.Net has got better.Think about moving - check my blog:
Blog (main)Blog (mirror)