Im trying to open a file that can have some really, really wierd characters. Any file open sub I try interprets those box characters as line breaks, or some other wierd thing like that. Say I had the attached zip. How could I have a sub that read the exact text?
Make sure you read the file in notepad and compare it to what the sub reads it as
To help you out we really need to see the code you are using. What I suspect is that you are reading the data in, but storing it in a string. Instead what you want to do is store it in a byte array.
It is my firm conviction, that you should never have firm convictions.
Every time I download test.zip, and then try to open it winzip says it is an invalid archive. Maybe you should try posting it again.
>I did make it a string. Ill change that later
Don't bother asking for more help on the subject until you try using byte arrays instead of strings as it is highly likely that this is the problem. Keep in mind that you need to open the file in binary mode and read the data directly into the byte array.
Here's some sample code to read it (written off the top of my head so may contain syntax errors)
--------------------------
dim bytes() as byte
dim fileNum as integer
dim fileSize as long
fileNum = freefile
open "c:\testfile.test" for binary as #fileNum
fileSize = lof(fileNum)
redim bytes(0 to fileSize - 1)
get #fileNum, bytes
close #fileNum
---------------------------------
That will read in your file. Keep in mind, though that if you take the data in your byte array then shove it into a string it will still mess up the data, because the characters that are causing the problems are still there. You will have to perform all operations on your data from the byte array, and write it back out with the byte array.
One thing that might help for future posts is if you tell us what you want to do with the data once you've read it in.
It is my firm conviction, that you should never have firm convictions.