freefile???

Laurent06
05-02-2003, 11:25 AM
Hi I read from a text file by a code I found on the forum but I can't figure out what freefile mean!

Somebody can help me for this????

Thx a lot

OnErr0r
05-02-2003, 11:31 AM
FreeFile gets the first free file number 1-511.

http://msdn.microsoft.com/library/en-us/vbenlr98/html/vafctFreeFile.asp

reboot
05-02-2003, 11:32 AM
It returns a free file handle. Put your cursor on it and press F1 in the VB IDE.

JDYoder
05-02-2003, 11:34 AM
FreeFile simply assigns the next file number that's free for use. You can do it manually, but FreeFile guarantees that the file number is available.

For instance, you can do it manually like this...

Open "this.txt" For Input As #1
Open "that.txt" For Input As #2
[do what you need with 1 and 2]


But it's smarter to use this...

iF1 = FreeFile
iF2 = FreeFile
Open "this.txt" For Input As #iF1
Open "that.txt" For Input As #iF2
[then do what you need with iF1 and iF2]


Because if you accidentally try to access two files using the same number, you'll have problems. FreeFile keeps that from ever happening.

OnErr0r
05-02-2003, 11:37 AM
FreeFile simply assigns the next file number that's free for use. You can do it manually, but FreeFile guarantees that the file number is available.

For instance, you can do it manually like this...

Open "this.txt" For Input As #1
Open "that.txt" For Input As #2
[do what you need with 1 and 2]


But it's smarter to use this...

iF1 = FreeFile
iF2 = FreeFile
Open "this.txt" For Input As #iF1
Open "that.txt" For Input As #iF2
[then do what you need with iF1 and iF2]


Because if you accidentally try to access two files using the same number, you'll have problems. FreeFile keeps that from ever happening.

In calling FreeFile back to back like that you're getting the SAME file number twice. You should call FreeFile and then an Open Statement, never two FreeFile functions back to back.

JDYoder
05-02-2003, 11:39 AM
Whoops! Good call. Thanks for covering my back. :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum