Topic : The GFA-Basic Compendium Author : GFA Systemtechnik GmbH Version : GFABasic.HYP v2.98 (12/31/2023) Subject : Documentation/Programming Nodes : 899 Index Size : 28056 HCP-Version : 3 Compiled on : Atari @charset : atarist @lang : @default : Document not found @help : Help @options : +g -i -s +z @width : 75 @hostname : STRNGSRV @hostname : CAB @hostname : HIGHWIRE @hostname : THING View Ref-FileINP(#n) INP&(#n) INP%(#n) OUT #n,a[,b,c,...] OUT& #n,a[,b,c,...] OUT% #n,a[,b,c,...] n: iexp INP(#n) reads a byte from a file which has been previously opened with OPEN. The numerical expression n is the channel number under which the file was OPENed. INP&(#n) reads a word (two-byte value) from a file. INP%(#n) reads a long (four-byte value) from a file. Thus a%=INP%(#1) can replace a%=CVL(INPUT$(4,#1)). OUT #n sends a byte to a file which was been previously opened with OPEN. The numerical expression n is the channel number under which the file was OPENed. Only the low-order 8 bits of a, b, c, ... are output, thus limiting their values to 255. OUT& #n sends a word (two-byte value) to a file. OUT% #n sends a long (four-byte value) to a file. INP() and OUT without the '#' can also be used for communication with the screen, keyboard, etc. (e.g. INP(2) reads a character from the keyboard). See the section called "Communicating with Peripherals". Example: OPEN "o",#1,"TEST.TXT" OUT #1,128 CLOSE #1 ' OPEN "i",#1,"TEST.TXT" a=INP(#1) CLOSE #1 PRINT a --> In the first part of the example a file is opened for output and a byte is written to it. In the second part this byte is read back in as the variable 'a' which when printed is revealed to have the value 128. Memo: INP(#n), INP&(#n), and INP%(#n) incorrectly return error code 0 if the #channel number is incorrect. Fread()+, Fwrite()+