home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 13
/
CD_ASCQ_13_0494.iso
/
maj
/
419
/
freadlin.bas
< prev
next >
Wrap
BASIC Source File
|
1994-03-13
|
1KB
|
41 lines
' +----------------------------------------------------------------------+
' | |
' | PBClone Copyright (c) 1990-1994 Thomas G. Hanlin III |
' | |
' +----------------------------------------------------------------------+
DECLARE FUNCTION FGetLoc2& (BYVAL FileHandle%)
DECLARE SUB FSetLoc (BYVAL FileHandle%, Posn&)
DECLARE SUB SFRead (BYVAL FileHandle%, St$, BytesRead%, ErrCode%)
SUB FReadLine (FileHandle%, Dest$, DLen%, TooLong%, ErrCode%)
Posn& = FGetLoc2&(FileHandle%)
Buffer$ = SPACE$(LEN(Dest$) + 2)
SFRead FileHandle%, Buffer$, BytesRead%, ErrCode%
IF ErrCode% <= 0 THEN
IF ErrCode% < 0 AND BytesRead% > 0 THEN ErrCode% = 0
Buffer$ = LEFT$(Buffer$, BytesRead%)
tmp% = INSTR(Buffer$, CHR$(13) + CHR$(10))
IF tmp% THEN
DLen% = tmp% - 1
Adjustment% = DLen% + 2
ELSE
DLen% = LEN(Buffer$)
Adjustment% = DLen%
END IF
LSET Dest$ = Buffer$
IF DLen% > LEN(Dest$) THEN
TooLong% = -1
DLen% = LEN(Dest$)
Adjustment% = DLen%
ELSE
TooLong% = 0
END IF
Posn& = Posn& + CLNG(Adjustment%)
FSetLoc FileHandle%, Posn&
ELSE
DLen% = 0
TooLong% = 0
END IF
END SUB