"Fossies" - the Fresh Open Source Software Archive 
Member "FreeBASIC-1.09.0-win64/examples/manual/fileio/access.bas" (1 Jan 2022, 896 Bytes) of package /windows/misc/FreeBASIC-1.09.0-win64.zip:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Visual Basic source code syntax highlighting (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 '' examples/manual/fileio/access.bas
2 ''
3 '' NOTICE: This file is part of the FreeBASIC Compiler package and can't
4 '' be included in other distributions without authorization.
5 ''
6 '' See Also: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgAccess
7 '' --------
8
9 Dim As Integer o
10
11 '' get an open file number.
12 o = FreeFile
13
14 '' open file for read-only access.
15 Open "data.raw" For Binary Access Read As #o
16
17 '' make a buffer in memory thats the entire size of the file
18 Dim As UByte file_char( LOF( o ) - 1 )
19
20 '' get the file into the buffer.
21 Get #o, , file_char()
22
23 Close
24
25 '' get another open file number.
26 o = FreeFile
27
28 '' open file for write-only access.
29 Open "data.out" For Binary Access Write As #o
30
31 '' put the buffer into the new file.
32 Put #o, , file_char()
33
34 Close
35
36 Print "Copied file ""data.raw"" to file ""data.out"""
37
38 Sleep