Re: File IO-I am defeated!
- From: "Mike Williams" <mikea@xxxxxxxxxxxxxxxxx>
- Date: Fri, 29 Feb 2008 09:44:01 -0000
"PeterD" <peter2@xxxxxxxxxx> wrote in message news:shfes31o6s7m2537pe2lnlks89sl1jl0sl@xxxxxxxxxx
Again if I had access to the file I could fix it, my problem
is that it fails on user's machines that I have absolutely no
access to.
So add some code to trap the error and have the error routine run the code I posted in my last response, except change my code so that it send its output to a log file instead of to a ListBox. It only logs a total of 256 bytes, allowing you to analyse the content of the small log file in a way which will undoubtedly solve your problem.
[my posted test code snipped] Again... <g>
No. Not again <g>. If you actually look at the code I posted you will see it is quite different from the code I posted previously. This new code opens the suspect file and produces a list of exactly 256 bytes, with each of the 256 bytes telling you how many of that specific character code are in the file.
I've gotten good ideas from you and others which
I'll try out. It takes time, basically I have to write
'new' code, put it into production, and wait for run
time error statistics to be generated.
Yes. Exactly as I have decribed above. You are telling us that these files contain only "standard text characters", and that you have produced them using your own code so you are certain you are correct. But if you actually were correct then you would not ever get the specific error you have reported.
Your own code (the code you posted) will happily load a file containing whatever bytes values you wish, whether they are what you would call standard text characters or not, EXCEPT it will fail with exactly the error you describe if there is a Chr(0) or a Chr(26) anywhere in the file. I would bet my bottom dollar that when you eventually get the log back (as described above) from the faulty file you will find at least one of those characters in there, most probably the zero. Perhaps sometimes the file you are loading has been saved in Unicode format, which would still produce a text file that can be read by most modern text editors but one which would fail to load with the code you are currently using, because it is half full of zeros. Or, more likely, something is placing a stray 26 or zero in the file, perhaps a "trailing zero" at the end of one or more text strings produced by some C code and where your code that wrote the file failed to remove the trailing zero.
The turn around time remindes me of my days in grad
school when we used punch cards, and often would not
see results for a day! You remember: the good old days!
I certainly do ;-)
Mike
.
- References:
- File IO-I am defeated!
- From: PeterD
- Re: File IO-I am defeated!
- From: Larry Serflaten
- Re: File IO-I am defeated!
- From: PeterD
- Re: File IO-I am defeated!
- From: Mike Williams
- Re: File IO-I am defeated!
- From: PeterD
- File IO-I am defeated!
- Prev by Date: Re: Bit surprised there aren't more virtual listbox controls/code available
- Next by Date: Re: Bit surprised there aren't more virtual listbox controls/code
- Previous by thread: Re: File IO-I am defeated!
- Next by thread: Re: File IO-I am defeated!
- Index(es):
Relevant Pages
|