{{fbdoc item="title" value="RESET"}}----
Closes all open files, or resets standard I/O handles.

{{fbdoc item="syntax"}}##
	[[KeyPgDeclare|declare]] [[KeyPgSub|sub]] **Reset** ( )
	[[KeyPgDeclare|declare]] [[KeyPgSub|sub]] **Reset** ( [[KeyPgByval|byval]] //streamno// [[KeyPgAs|as]] [[KeyPgLong|long]] )
##
{{fbdoc item="usage"}}##
	**Reset**
//or//
	**Reset**( //streamno// )
##
{{fbdoc item="param"}}
	##//streamno//##
		The stream number to reset, ##0## for stdin or ##1## for stdout.

{{fbdoc item="desc"}}
	##**Reset**##, when called with no arguments, closes all disk files.
	
	##**Reset**##, when called with the ##//streamno//## argument, will reset the redirected or piped streams associated with stdin (##0##), or stdout (##1##).
	
**Runtime errors:**
	##**Reset(//streamno//)**## can set one of the following [[ProPgErrorHandling|runtime errors]]:
	
	//(##1##) Illegal function call//
		- ##//streamno//## was neither ##0## nor ##1##
	
	//(##3##) File I/O error//
		- Resetting of stdin or stdout failed

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/fileio/reset.bas"}}%%(freebasic)
open "test.txt" for output as #1
print #1, "testing 123"
reset
%%

{{fbdoc item="filename" value="examples/manual/fileio/resetio.bas"}}%%(freebasic)
dim x as string

'' Read from STDIN from piped input
open cons for input as #1
while eof(1) = 0
  input #1, x
  print """"; x; """"
wend
close #1

'' Reset to read from the keyboard
Reset(0)

print "Enter some text:"
input x

'' Read from STDIN (now from keyboard)
open cons for input as #1
while eof(1) = 0
  input #1, x
  print """"; x; """"
wend
close #1
%%
		Note: Under Windows, to specify to the program that data entry is completed (transfer EOF), you can press CTRL+Z then press ENTER.

{{fbdoc item="diff"}}
	- None for ##**Reset**()##.
	- The ##**Reset**(//streamno//)## usage is new to ""FreeBASIC"".

{{fbdoc item="see"}}
	- ##[[KeyPgClose|Close]]##
	- ##[[KeyPgOpen|Open]]##
	- ##[[KeyPgOpenCons|Open Cons]]##
	- ##[[KeyPgIsredirected|IsRedirected]]##

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