You are here: start » ppl » statements » fnext

FNEXT()

FNEXT()

Returns an availble file channel. -1 when none are available.

Example:

	println "The next available file channel is ",FNEXT()

FNEXT was created in order to better support code libraries made possible by functions and procedures. File channel numbers can now be determined at runtime.
CAUTION: Until you actually OPEN a file FNEXT will return the same value over and over.

	chan1 = FNEXT() chan2 = FNEXT()  WRONG! chan1 will equal chan2 )  
	

another gotcha: FOPEN FNEXT(),blah blah
There is no way to determine what channel was used to open the file!
Here's an example of how it should be used:

	chan1 = FNEXT() FOPEN   chan1,...  
	chan2 = FNEXT() FOPEN   chan2,...  

See also: FOpen FClose FCreate FAppend FRewind FCloseAll

ppl/statements/fnext.txt · Last modified: 2019/04/16 14:00
CC Attribution 4.0 International Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution 4.0 International