Input # statement - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Reads data from a file, and stores the data in variables.

Syntax

Input # filenum, var_name [ , var_name... ] 

filenum is the number of a file opened through the Open File statement.

var_name is the name of a variable.

Description

The Input # statement reads data from a file which was opened in a sequential mode (for example, INPUT mode), and stores the data in one or more MapBasic variables.

The Input # statement reads data (up to the next end-of-line) into the variable(s) indicated by the var_name parameter(s). MapInfo Pro treats commas and end-of-line characters as field delimiters. To read an entire line of text into a single string variable, use Line Input statement.

MapBasic automatically converts the data to the type of the variable(s). When reading data into a string variable, the Input # statement treats a blank line as an empty string. When reading data into a numeric variable, the Input # statement treats a blank line as a zero value.

After issuing an Input # statement, call the EOF() function to determine if MapInfo Pro was able to read the data. If the input was successful, the EOF() function returns FALSE; if the end-of-file was reached before the input was completed, the EOF() function returns TRUE.

For an example of the Input # statement, see the sample program NVIEWS (Named Views).

The following data types are not available with the Input # statement:

  • Alias
  • Pen
  • Brush
  • Font
  • Symbol
  • Object

See Also:

EOF() function, Line Input statement, Open File statement, Write # statement