GETC function

Purpose: GETC returns the ASCII code value of a character from the input of the file in the hFile parameter and increments the file pointer to point to the next character in the file.


 Syntax:

 RetVal% = GETC(hFile)

 Parameters:

  • hFile Name of handle to file from which ASCII code is read.

 Return Value:

  • RetVal%, the return value, is an ASCII code value of a character read from hFile.

Example: Cut and save the example as GETC.BAS. Translate and compile it. Run it as GETC | more.


 DIM a$
 DIM b%

 OPEN "getc.bin" FOR BINARY NEW AS FP1
 FOR INTEGER O = 0 TO 255
  a$ = CHR$(O)
  PUT$ FP1, a$, 1
 NEXT O
 CLOSE FP1

 OPEN "getc.bin" FOR BINARY AS FP1
 FOR INTEGER O = 0 TO 255
  b% = GETC(FP1)
  PRINT b%
 NEXT O
 CLOSE FP1

 END

BCX Console Sample Programs using GETC function.

S146.bas