|
-
Mar 8th, 2000, 01:07 AM
#1
Thread Starter
Lively Member
Hi vb-world:
I only want to aks a simple question;
How can i write and/or read binary files?, I'm using the method Open "file" For Binary Access Write As #1 but I can write into the file. If I use Print, Write or Put #1 I get an error. What I'm doing wrong?
Thanks in advance.
Best Regards,
Angel Maldonado López.
VB Programmer
-
Mar 8th, 2000, 02:39 AM
#2
New Member
your question isnt exactly simple. in order to read or write to it, you must use an array, such as b() which is of type BYTE. you cant read or write to it using variables of types string and the like.
dim b() as btye
b() = Inet1.OpenURL("www.site.com/images/pic.jpg", icByteArray)
Open "picture.jpg" For Binary Access Write As #1
Put #1, , b()
Close #1
b() is now an array of bytes. you can see why this is necessary since a jpg is binary, not ascii. trying to Put ascii instead of binary is a very common cause for errors.
look at the INET.HLP or INET98.CHM files for more information on writing to binary files from the internet.
It would also help to explain the purpose for reading and writing to binary files. This would help people in understanding your dilemma so they can provide a solution.
Matt Calderaro
Public Software
-
Mar 8th, 2000, 03:08 AM
#3
Thread Starter
Lively Member
Hi mcalderaro.
Sorry, I thought that work with binary files was simple like ascii files, thanks a lot for your help and I'm going to work with this code, thanks again.
Regards.
Angel Maldonado López.
VB Programmer
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
|