Open files
Use WUNC (Wildcat Universal Name Conversion). Here you are going to the c:\wc5\data directory which is represented by the WUNC wc:\data\. This
allows you to run your code from ANY machine on the network. Doing it with physical paths, forces it to one machine.
Avoid the open as #1. What if #1 is already used up? The method shown in the example will open the next available number.
Always check for errors, using GetLastError to find out what error it is.
Here is an example code:
dim hFile as integer = open "wc:\data\text.txt" for input if hFile <> then input #hFile, e close #hFile else
print "Error ";GetLastError(); " opening file" end if
|
|