FINPUT statement

Purpose:

FINPUT will input, from a file, lines of comma separated values into a parameter list of comma separated variables in a manner similar to the QBasic INPUT # function. The values in the file can be any of string, integer or floating point data types.

Syntax:

FINPUT hFile, Variable1, Variable2, ...

Parameters:

  • Data type: FILE
    hFile The handle of file from which variable values will be retrieved.
  • Variable1, Variable2, ... Parameter list of comma separated variables which will receive the corresponding values from the file. The data type of these variables can be any of string, integer or floating point data types.

Remarks:

See the INPUT (from file) statement which also will input, from a file, lines of comma separated values.

Example:

DIM P, N!, E#, L!, D$, j, random!
  
OPEN "TEST.TXT" FOR OUTPUT AS FP1
  
FOR j = 1 TO 10
  random! = j * 100.0 * RND
  FPRINT FP1, j , ",", random!, ",", 12356789.012345#, ",", j + 10, ",", "This string has spaces"
NEXT
  
CLOSE FP1
  
OPEN "TEST.TXT" FOR INPUT AS FP1
  
WHILE NOT EOF(FP1)
  FINPUT FP1, P, N!, E#, L!, D$
  PRINT P, " ", N!, " ", E#, " ", L!, " ", D$
WEND
  
CLOSE FP1

Result:

1  30.7502  12356789.012345  11 This string has spaces
2  25.16729  12356789.012345  12 This string has spaces
3  1.085675  12356789.012345  13 This string has spaces
4  283.6385  12356789.012345  14 This string has spaces
5  278.4921  12356789.012345  15 This string has spaces
6  413.7066  12356789.012345  16 This string has spaces
7  292.6958  12356789.012345  17 This string has spaces
8  220.4182  12356789.012345  18 This string has spaces
9  839.6696  12356789.012345  19 This string has spaces
10  192.1887  12356789.012345  20 This string has spaces