{{fbdoc item="title" value="OPEN SCRN"}}----
Opens the console directly for input and output as a file

{{fbdoc item="syntax"}}##
	**[[KeyPgOpen Open]] Scrn** [for //mode//] [[KeyPgAs as]] [#]//filenum// [[KeyPgAs as]] [[KeyPgLong long]]
##
{{fbdoc item="usage"}}##
	**Open Scrn** [for //mode//] as [#]//filenum//
		//or//
	//result// = **Open Scrn**( [for //mode//[,]] as [#]//filenum// )
##
{{fbdoc item="param"}}
	##//mode//##
		Either ##[[KeyPgInputfilemode Input]]## or ##[[KeyPgOutput Output]]##.  If omitted, ##[[KeyPgOutput Output]]## is assumed.
	##//filenum//##
		An unused file number.

{{fbdoc item="ret"}}
	Zero (##0##) is returned if ##**Open Err**## completed successfully, otherwise a non-zero value is returned to indicate failure.

{{fbdoc item="desc"}}
	This command opens the console for both input and output as a file, allowing to read/write from/to it with normal file commands.

	This command may use direct access to the console for speed in some implementations, so  it should not be used when the input / output is required to be redirected or piped with OS commands.    

	The normal console commands, such as ##[[KeyPgColor Color]]## and ##[[KeyPgLocate Locate]]##, do not work in this mode, because they do not accept a file number.

	The ##[For Input|Output]## clause is allowed for compatibility, but is ignored.

	##//filenum//## is an unused file number.

	An unused file number can be found using ##[[KeyPgFreefile FreeFile]]##.

	
**Runtime errors:**
	    ##**Open Cons**## throws one of the following [[ProPgErrorHandling runtime errors]]:

	//(##1##) Illegal function call//
		- ##//filenumber//## was not free at the time. use ##[[KeyPgFreefile Freefile]]## to ensure that ##//filenumber//## is free.
		
		

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/fileio/openscrn.bas"}}%%(freebasic)
dim a as string
OPEN SCRN for input  AS #1
print #1,"Please write something and press ENTER"
line input #1,a
PRINT #1, "You wrote";a
CLOSE
sleep
%%

{{fbdoc item="diff"}}
	- QB used OPEN "SCRN:" ...

{{fbdoc item="see"}}
	- ##[[KeyPgOpen Open]]##
	- ##[[KeyPgOpenCons Open Cons]]##

{{fbdoc item="back" value="CatPgFile|File I/O Functions"}}