|
-
Apr 21st, 2003, 12:53 PM
#1
Thread Starter
Frenzied Member
Open files binary (solved) and sending it.. then writting it again (PROBLEM)
VB Code:
Open App.Path & "\temp.bmp" For Binary Access Read As #iHandle
Do Until EOF(iHandle)
Get #iHandle, , a$
packets = packets + 1
DoEvents
Loop
Close #iHandle
what am i doing wrong? it seems to be stuck ina loop (the packets thing is just a test)
Last edited by Ultimasnake; Apr 23rd, 2003 at 07:43 AM.
-
Apr 21st, 2003, 01:32 PM
#2
PowerPoster
the following works fine. you need to lose the loop and dimension a as either a byte array or a fixed length string
VB Code:
Dim a(20000) As Byte
Dim iHandle As Integer
iHandle = FreeFile
Open App.Path & "\new.xls" For Binary Access Read As #iHandle
Get #iHandle, , a
DoEvents
Close #iHandle
-
Apr 21st, 2003, 01:37 PM
#3
Thread Starter
Frenzied Member
ok so the loop isnt there anymore.. is there anyway to detiremine how many of those things are used? i have to read it all as binary and then send it part by part to a client program
i tried UBound(a) with "a" declared as A() as byte
but i get a supscript out of range :S
-
Apr 21st, 2003, 02:41 PM
#4
The picture isn't missing
??? it will get EVERYTHING. If you want to read it in chunks you could do something like
Dim bBytes(2047) as byte '2048 bytes or 2K
Open File for Binary As #1
Do Until LOF(1) = Loc(1) Or EOF(1) 'loc(1) if the current byte, lof(1) is the length of the file
Get #1, , bBytes
'now do something with bbytes
'then continue looping
loop
Close #1
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Apr 23rd, 2003, 07:46 AM
#5
Thread Starter
Frenzied Member
Ok that works buggyprogrammer.. any tips on how to write it again? cant seem to make that work perfectly this is what i have now
VB Code:
Open App.Path & "\tmp.bmp" For Binary Access Write As #iHandle
'every time i get a raw package i will do this (in a sub)
strmessage = GetStringFromBuffer(dpnotify.ReceivedData, lngOffset)
Put #iHandle, , strmessage
'when i have recieved all packages (that i sent in a command that tells the client he will be recieving raw picture data)
Close #iHandle
but the filesizes arn't even equal :s
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
|