|
-
Mar 23rd, 2002, 09:42 PM
#1
Thread Starter
New Member
Reading a file a byte at a time
Hi everyone:
I am trying to read from a file one byte at a time because I need to take part of the existing bytes in a file and then save it in a new one. I am including here how I am trying to do it but it seems it does not work ????
Private Sub Command2_Click()
Dim size As Long
Dim myByteArray() As Byte
Dim Temporary As Byte
Open "c:\test.wav" For Input As #1
For i = 1 To i = 1000
Input #1, i, Temporary
myByteArray(i) = Temporary
Next
Close #1
Open "c:\test1.wav" For Output As #2
For w = 1 To w = 1000
Write #2, w, myByteArray(w)
Next
Close #2
End Sub
**** any suggestions will be very appreciated !!!!
Thanks
Rene
-
Mar 23rd, 2002, 10:08 PM
#2
Code:
dim i as Byte
open "c:\test.wav" for binary as #1
Do while not Eof(1)
get #1,,i
' i is now one byte of data
Loop
Close #1
-
Mar 23rd, 2002, 10:11 PM
#3
Try:
VB Code:
Private Sub Form_Load()
Dim iBuff As Byte
Open "C:\test.wav" For Binary As #1
Get #1, , iBuff
Close #1
MsgBox iBuff
End Sub
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
|