|
-
Mar 8th, 2007, 01:43 PM
#1
Thread Starter
Addicted Member
open in sub, get in function HELP!
I have a sub that opens a file as binary.
In that sub i have a loop that will call a function, and the function looks inside file, and returns a value. Well its not working, the function doesnt know that the file is open. kinda like this:
Code:
Public Sub x()
....
Open (file) for Binary As #1
For i = 1 to 10
arr(4) = Grabit(arr(1), arr(2), arr(3))
Next
Close #1
....
EndSub
Function Grabit(start, num, kind) as string
Select Case Kind
Case "Word"
Get #1, start, String
EndFunction
well its quick and dirty example, but you get the point. Is it possible?
-
Mar 8th, 2007, 02:19 PM
#2
Re: open in sub, get in function HELP!
does your function "know" all the values you are using in the Sub that opens the file? (especialy "#1")?
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Mar 8th, 2007, 02:25 PM
#3
Re: open in sub, get in function HELP!
For one thing, Get #1, start, String won't work (String is a reserved word). And there's no End Select. And you have to set Grabit equal to whatever it's supposed to be returning.
Once you clean up all the obvious errors, using the Get statement in the function should work.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Mar 8th, 2007, 04:03 PM
#4
Thread Starter
Addicted Member
Re: open in sub, get in function HELP!
well i didnt copy+paste the code in, it was WAY to long to do so, so i just did a quick "off-the-top-of-the-head" sample to get the point across. I know there are a bunch of errors in the sample code, and it wouldnt compile.
-
Mar 8th, 2007, 06:17 PM
#5
Re: open in sub, get in function HELP!
So how do you expect help with code that you give that is incorrect to correct a problem with code that you do not show?????
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|