home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 13 / CD_ASCQ_13_0494.iso / maj / 419 / freadlin.bas < prev    next >
BASIC Source File  |  1994-03-13  |  1KB  |  41 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |        PBClone  Copyright (c) 1990-1994  Thomas G. Hanlin III        |
  4. '   |                                                                      |
  5. '   +----------------------------------------------------------------------+
  6.  
  7.    DECLARE FUNCTION FGetLoc2& (BYVAL FileHandle%)
  8.    DECLARE SUB FSetLoc (BYVAL FileHandle%, Posn&)
  9.    DECLARE SUB SFRead (BYVAL FileHandle%, St$, BytesRead%, ErrCode%)
  10.  
  11. SUB FReadLine (FileHandle%, Dest$, DLen%, TooLong%, ErrCode%)
  12.    Posn& = FGetLoc2&(FileHandle%)
  13.    Buffer$ = SPACE$(LEN(Dest$) + 2)
  14.    SFRead FileHandle%, Buffer$, BytesRead%, ErrCode%
  15.    IF ErrCode% <= 0 THEN
  16.       IF ErrCode% < 0 AND BytesRead% > 0 THEN ErrCode% = 0
  17.       Buffer$ = LEFT$(Buffer$, BytesRead%)
  18.       tmp% = INSTR(Buffer$, CHR$(13) + CHR$(10))
  19.       IF tmp% THEN
  20.          DLen% = tmp% - 1
  21.          Adjustment% = DLen% + 2
  22.       ELSE
  23.          DLen% = LEN(Buffer$)
  24.          Adjustment% = DLen%
  25.       END IF
  26.       LSET Dest$ = Buffer$
  27.       IF DLen% > LEN(Dest$) THEN
  28.          TooLong% = -1
  29.          DLen% = LEN(Dest$)
  30.          Adjustment% = DLen%
  31.       ELSE
  32.          TooLong% = 0
  33.       END IF
  34.       Posn& = Posn& + CLNG(Adjustment%)
  35.       FSetLoc FileHandle%, Posn&
  36.    ELSE
  37.       DLen% = 0
  38.       TooLong% = 0
  39.    END IF
  40. END SUB
  41.