Question about opening files...

09-08-2002, 09:16 PM
What exactly does this line of code do?


data = Input$(LOF(1), 1)


i am assuming that LOF means "length of file" but I wonder what the ...(1), 1) is for...

09-08-2002, 09:53 PM
the number 1 is the filenumber.. it could be a 2 or 3 or whatever number you opened the file up with.

09-08-2002, 10:07 PM
what about the second 1?

09-08-2002, 10:13 PM
data = Input$(LOF(1), 1)

Both the number 1's mean the file number you are working with.
What this statement will do is store the entire file into the data variable. The LOF(1) means to take the entire file, which is number 1 because that is what you opened it up with and store that in the variable.

You could have something like this:
data = Input$(1,1)
This statement will get only 1 character from the file
data = Input$(5,1)
This statement will get only 5 characters from file number 1 and so on...........

The very last number 1 is the file number. The first number is just saying how much data do I want to return.

09-08-2002, 10:16 PM

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum