{{fbdoc item="title" value="ACCESS"}}----
Clause of the ##[[KeyPgOpen|Open]]## statement to specify requested privileges

{{fbdoc item="syntax"}}##
	[[KeyPgOpen|open]] //filename// for [[KeyPgBinary|binary]] **Access** {**Read** | **Write** | **Read Write**} as [#]//filenum//
##
{{fbdoc item="usage"}}##
	open //filename// for binary **Access Read** as #//filenum//
	open //filename// for binary **Access Write** as #//filenum//
	open //filename// for binary **Access Read Write** as #//filenum//
##
{{fbdoc item="param"}}
	##Read##
		Open the file with only read privileges.
	##Write##
		Open the file with only write privileges.
	##Read Write##
		Open the file with read and write privileges.

{{fbdoc item="desc"}}
	##Access## is used with the ##[[KeyPgOpen|Open]]## statement to request read, write, or read and write privileges.  If the ##Access## clause is not specified, ##Read Write## is assumed.

{{fbdoc item="ex"}}

This example shows how to open the file "data.raw" with ##[[KeyPgReadFile|read]]## and then "data.out" with ##[[KeyPgWriteFile|write]]## access, in ##[[KeyPgBinary|Binary]]## mode, in an open file number returned by ##[[KeyPgFreefile|FreeFile]]##.
	{{fbdoc item="filename" value="examples/manual/fileio/access.bas"}}%%(freebasic)
Dim As Long o

  '' get an open file number.
  o = FreeFile
  
  '' open file for read-only access.    
  Open "data.raw" For Binary Access Read As #o
	
	'' make a buffer in memory thats the entire size of the file
	Dim As uByte file_char( Lof( o ) - 1 )

	  '' get the file into the buffer.      
	  Get #o, , file_char()
	
  Close
  
  '' get another open file number.
  o = FreeFile
  
  '' open file for write-only access.    
  Open "data.out" For Binary Access Write As #o

	'' put the buffer into the new file.      
	Put #o, , file_char()
	
  Close

  Print "Copied file ""data.raw"" to file ""data.out"""

  Sleep
%%
{{fbdoc item="diff"}}
	- None known.

{{fbdoc item="see"}}
	- ##[[KeyPgOpen|Open]]##
	- ##[[KeyPgReadFile|Read]]##
	- ##[[KeyPgWriteFile|Write]]##

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