Functions.FGetS 方法 (IntPtr) |
命名空间: XSharp.Core
1ptrHandle := FOpen2("docs.txt", FO_READ) 2IF ptrHandle != F_ERROR 3 DO WHILE !FEOF(ptrHandle) 4 ? FGets(ptrHandle) 5 ENDDO 6ENDIF 7FClose(ptrHandle)
1FUNCTION Grep(cSearch, cFile AS STRING) ; 2 AS DWORD PASCAL 3 LOCAL handle AS PTR 4 LOCAL Count AS DWORD 5 LOCAL Line AS STRING 6 handle := FOpen2(cFile, FO_READ) 7 cSearch := Upper(cSearch) 8 DO WHILE !FEOF(handle) 9 line := Upper(FGets(handle)) 10 IF InStr(cSearch, line) 11 ? line 12 Count += 1 13 ENDIF 14 ENDDO 15 RETURN Count