User | Post |
Kenny3900
Posts: 7/9 |
Originally posted by HyperHacker You can do that? Seeing how you can't assign to an array, that's quite surprising.
Which VB version you use? It ran correctly for me. I haven't go in depth of the program, but I tried the get/put part and there's no error. I'm using VB6. |
Chickenlump
Posts: 53/722 |
Thank you both so much! All this is very interesting. Since I'm in a learning mood lately, I'll be pesky and ask... What do you mean by "Cant's assign to an array"?
|
HyperLamer
Posts: 147/8210 |
You can do that? Seeing how you can't assign to an array, that's quite surprising. |
Kenny3900
Posts: 6/9 |
I'd rather do it like this:
... Dim Temp() as Byte ... Redim Temp(LOF(nFileNum) - 512) ' 512 = &H200 ... Get nFileNum, 513, Temp 'File pointer starts at 1. Put nFileNum2, 1, Temp ...
|
HyperLamer
Posts: 142/8210 |
Dim i as Long, nFileNum as Integer, FileNum2 as Integer Dim TempByte as Byte nFileNum = FreeFile Open "C:\Somefile" for Binary as #nFileNum FileNum2 = FreeFile Open "C:\OutputFile" for Binary as #FileNum2 For i = &h200 to LOF(nFileNum) Get #nFileNum, i, TempByte Put #FileNum2, i-&h200, TempByte DoEvents 'So it doesn't crash Next i Close #nFileNum Close #FileNum2 |
Darth Coby
Posts: 129/1371 |
Load it as binary, then start reading from byte number $200. Then dump it to another file and replace, that should work. Just like you said. I don't know how you'd start reading from byte number $200 though. |
Chickenlump
Posts: 48/722 |
I am curious if it's possible to delete bytes from a file with Visual Basic 6. I was hoping someone here could help me. I was just going to code a small tool for myself to delete the snes header off of the Rom, which I belive is the first 200 bytes. Someone mentioned that I could start reading the file from that offset, and dump to another file, and just rename it, but I'm not sure how to go about that just yet. Or, if there's an easier way that would be cool too. I know there's tools already available to delete the header, but I wouldn't learn anything in the process, and it would be more convinent to just have it built in to my little app.
Thanks for any replies. |