Acmlm's Board - I2 Archive - Programming - Help!!
User | Post |
dan
Posts: 10/782 |
You could try these functions I wrote a few years ago to do just that. You need to setup the table within the module to use it. |
jescis
Posts: 6/38 |
Ok, that worked, thanx.
now, how do I put the text from the rom into a textbox? |
Acmlm
Posts: 228/1173 |
Hmm ok, FreeFile just returns the first available file number? (like #1)
So you give FileNum that value, then try to load something from it ... but where do you open the file? What the code does is this:
- Show a "Open file" dialog where you can select *.* or *.fds - If you select no file, exit - Put the selected filename in sFile - Get a free file number and put it in FileNum - Load from that file number at offset $65 and store in the sFile variable
Something isn't right, at the end
Try this instead:
FileNum = FreeFile Open sFile For Binary As FileNum
And to load from the file, use the variable you want the data to go in, not the filename ... also, it'll load as many bytes as the variable can hold (like 4 bytes for integer)
|
jescis
Posts: 5/38 |
I'm trying to make a SMB2j text editor.Don't laugh or anything because it would be my first editor program,other than a hello world program
it gives me "Bad file name or number (Error 52)" at the "Get FileNum, &H66, sFile " line. |
HyperLamer
Posts: 76/8210 |
Originally posted by jescis 'ToDo: add code to process the opened file
I assume that's it, but he'll need to tell us what sort of processing he intends to do. Also you should be printing sFile, not FileNum. |
dan
Posts: 8/782 |
Um, what's the problem exactly? Or what do you want help with? It would help us answer you if told us either of these things. |
jescis
Posts: 4/38 |
here is the code: Private Sub mnuFileOpen_Click()
Dim sFile As String
With dlgCommonDialog .DialogTitle = "Open" .CancelError = False 'The flags and attributes of the common dialog control .Filter = "All Files (*.*)|*.*|FDS Files (*.fds)|*.fds" .ShowOpen If Len(.FileName) = 0 Then Exit Sub End If sFile = .FileName FileNum = FreeFile End With 'ToDo: add code to process the opened file Get FileNum, &H66, sFile Text1.Print FileNum End Sub |
|