#Define CRLF Chr(13)+Chr(10) Local lnHandle,lnLine lnHandle = Fopen(Getfile('TXT')) lnLine = 0 Do While !Feof(m.lnHandle) lnLine = m.lnLine + 1 ? m.lnLine,FgetsSafe(m.lnHandle) Enddo Fclose(m.lnHandle) Procedure FgetsSafe Lparameters handle If Type('m.handle')#'N' Or m.handle<0 Return '' Endif Local lnCurPos,lnFileSize,lcPortion,lnNLPos,retline lnCurPos = Fseek(m.handle,0,1) && Save current pos lcPortion = Fread(m.handle,65500+255) && 65500 is max allowed recsize and 255 is fcount limit lnNLPos = Min(At(Chr(13),m.lcPortion), At(Chr(10),m.lcPortion)) && NL position If m.lnNLPos>0 && If NL chars encountered retline = Left(m.lcPortion, m.lnNLPos-1) =Fseek(m.handle,m.lnCurPos+m.lnNLPos,0) && Set position to just after NL If !(Fread(m.handle,1)$CRLF) =Fseek(m.handle,-1,1) Endif Else retline = m.lcPortion Endif Return m.retline EndprocCetin