{{fbdoc item="title" value="File I/O Functions"}}----
Statements and procedures for working with files and devices.

{{fbdoc item="desc"}}
	These statements and procedures provide file and device i/o capabilities. So called //file numbers// can be bound to files or devices, which can be read or written to using formatted (text mode) or unformatted (binary mode) data. In binary mode, files and devices can be read from or written to in arbitrary locations. For multithreaded applications, files and devices can also be locked.

**{{anchor name="FILEOPS|Opening Files or Devices"}}**
	Procedures and other keywords that provide read or write access to a file or device.
**{{anchor name="FILEIO|Reading from and Writing to Files or Devices"}}**
	Procedures that read and write data to an opened file or device.
**{{anchor name="FILEPOS|File Position and other Info"}}**
	Procedures that determine where reading and writing will take place within an opened file.
	
<<{{anchor name="FILEOPS"}}{{fbdoc item="section" value="Opening Files or Devices"}}
	=={{fbdoc item="keyword" value="KeyPgFreefile|FREEFILE"}}==
		Gets an available file number that can be used to read or write from files or devices.
	=={{fbdoc item="keyword" value="KeyPgOpen|OPEN"}}==
		Binds a file number to a physical file to provide reading and writing capabilities.
	=={{fbdoc item="keyword" value="KeyPgOpenCom|OPEN COM"}}==
		Binds a file number to a communications port.
	=={{fbdoc item="keyword" value="KeyPgOpenCons|OPEN CONS"}}==
		Binds a file number to the standard input and output streams.
	=={{fbdoc item="keyword" value="KeyPgOpenErr|OPEN ERR"}}==
		Binds a file number to the standard input and error streams.
	=={{fbdoc item="keyword" value="KeyPgOpenLpt|OPEN LPT"}}==
		Binds a file number to a printer device.
	=={{fbdoc item="keyword" value="KeyPgOpenPipe|OPEN PIPE"}}==
		Binds a file number to the input and output streams of a process.
	=={{fbdoc item="keyword" value="KeyPgOpenScrn|OPEN SCRN"}}==
		Binds a file number directly to the console.
	=={{fbdoc item="keyword" value="KeyPgOpenTcp|OPEN TCP"}}==
		Binds a file number to a TCP client connection.
	=={{fbdoc item="keyword" value="KeyPgOpenTcpServer|OPEN TCP SERVER"}}==
		Binds a file number to a listening TCP server socket.
	=={{fbdoc item="keyword" value="KeyPgClose|CLOSE"}}==
		Unbinds a file number from a file or device.
	=={{fbdoc item="keyword" value="KeyPgReset|RESET"}}==
		Unbinds all active file numbers.
		
	{{fbdoc item="subsect" value="File I/O modes"}}
		=={{fbdoc item="keyword" value="KeyPgInputfilemode|INPUT (File Mode)"}}==
			Text data can be read from the file.
		=={{fbdoc item="keyword" value="KeyPgOutput|OUTPUT"}}==
			Text data can be written to the file.
		=={{fbdoc item="keyword" value="KeyPgAppend|APPEND"}}==
			Text data is added to the end of a file when output.
		=={{fbdoc item="keyword" value="KeyPgBinary|BINARY"}}==
			Arbitrary data can be read from or written to the file.
		=={{fbdoc item="keyword" value="KeyPgRandom|RANDOM"}}==
			Blocks of data of certain size can be read from and written to the file.
			
	{{fbdoc item="subsect" value="File access privileges"}}
		=={{fbdoc item="keyword" value="KeyPgAccess|ACCESS"}}==
			An overview of file access privileges.
		=={{fbdoc item="keyword" value="KeyPgReadFile|READ (File Access)"}}==
			Binary data can only be read from the file.
		=={{fbdoc item="keyword" value="KeyPgWriteFile|WRITE (File Access)"}}==
			Binary data can only be written to the file.
		=={{fbdoc item="keyword" value="KeyPgReadWriteFile|READ WRITE(File Access)"}}==
			Binary data can be read from and written to the file.
			
	{{fbdoc item="subsect" value="Character encoding"}}
		=={{fbdoc item="keyword" value="KeyPgEncoding|ENCODING"}}==
			Specifies the character encoding of a file.
<<>>{{anchor name="FILEIO"}}{{fbdoc item="section" value="Reading from and Writing to Files or Devices"}}
	=={{fbdoc item="keyword" value="KeyPgInputPp|INPUT #"}}==
		Reads a list of values from a file or device.
	=={{fbdoc item="keyword" value="KeyPgWritePp|WRITE #"}}==
		Writes a list of values to a file or device.
	=={{fbdoc item="keyword" value="KeyPgInputnum|INPUT()"}}==
		Reads a number of characters from a file or device.
	=={{fbdoc item="keyword" value="KeyPgWinput|WINPUT()"}}==
		Reads a number of wide characters from a file or device.
	=={{fbdoc item="keyword" value="KeyPgLineinputPp|LINE INPUT #"}}==
		Reads a line of text from a file or device.
	=={{fbdoc item="keyword" value="KeyPgPrintPp|PRINT #"}}==
	=={{fbdoc item="keyword" value="KeyPgPrintPp|? # (Shortcut for 'PRINT #')"}}==
		Writes text data to a file or device.
	=={{fbdoc item="keyword" value="KeyPgPutfileio|PUT #"}}==
		Writes arbitrary data to a file or device.
	=={{fbdoc item="keyword" value="KeyPgGetfileio|GET #"}}==
		Reads arbitrary data from a file or device.
	=={{fbdoc item="keyword" value="KeyPgTcpAccept|TCP ACCEPT"}}==
		Accepts a TCP client from a server file number.
		
{{anchor name="FILEPOS"}}{{fbdoc item="section" value="File Position and other Info"}}
	=={{fbdoc item="keyword" value="KeyPgLof|LOF"}}==
		Gets the length (in bytes) of a file.
	=={{fbdoc item="keyword" value="KeyPgLoc|LOC"}}==
		Gets the file position of the last read or write operation.
	=={{fbdoc item="keyword" value="KeyPgEof|EOF"}}==
		Returns true if all of the data has been read from a file.
	=={{fbdoc item="keyword" value="KeyPgEoc|EOC"}}==
		Returns true if a TCP connection has been closed by the peer.
	=={{fbdoc item="keyword" value="KeyPgSeekset|SEEK (Statement)"}}==
		Sets the file position of the next read or write operation.
	=={{fbdoc item="keyword" value="KeyPgSeekreturn|SEEK (Function)"}}==
		Gets the file position of the next read or write operation.
	=={{fbdoc item="keyword" value="KeyPgLock|LOCK"}}==
		Restricts read or write access to a file or portion of a file.
	=={{fbdoc item="keyword" value="KeyPgUnlock|UNLOCK"}}==
		Remove read or write restrictions from a previous [[KeyPgLock|Lock]] command.
>>::c::

{{fbdoc item="back" value="DocToc|Table of Contents"}}
