PROCEDURE sysFGets LPARAM lnFileHandle,@pcBuffer,@FlagEOF LOCAL lcRetVal,lnAT lnBuffer = 10000 &&--bytes read in on each FREAD lnLimit = 1000 &&--minimum left to process before another FREAD IF LEN(gcBuffer) < lnLimit AND NOT FEOF(lnFileHandle) pcBuffer = pcBuffer + FREAD(lnFileHandle,lnBuffer) * With our luck, we'd split a CR/LF pair and fudge * things up, so better safe than sorry IF RIGHT(pcBuffer,2) = CHR(13) + CHR(10) AND FEOF(lnFileHandle) pcBuffer = pcBuffer + FREAD(lnFileHandle,3) ENDIF ENDIF * Get the position of CR/LF. Assume that we * always have CR/LF together, or monkey up code * to account for just one or the other. lnAT = AT(CHR(13),pcBuffer) lcRetVal = LEFT(pcBuffer,lnAT-1) * Either flip FEOF flag or snip off the text we returned IF lnAT = LEN(pcBuffer) - 1 FlagFEOF = .t. ELSE pcBuffer = SUBS(pcBuffer,lnAT+2) &&-- assuming CR/LF pair ENDIF RETURN lcRetValWell, I'm sure I've missed more than one something, as it's been awhile, but that is the gist of it. Hope this helps.