SRZ040816002359: "Error 62 - input past end of file" 4 messages -------------------------------------------------------------------------------- Jian-Wei Yu Wed, Aug 18, 2004 at 1:29AM Hi Chris, Thank you for contacting Microsoft. My name is Jian-Wei Yu, and I am the engineer who will be working with you on this case. According to the case log, the problem is: you will encounter "Error 62 - input past end of file" when read comma separated numbers from a file. I would like to know more information about the problem: 1. As the problem rarely happens, can you find any other symptoms when the error occurs? Especially the data it is reading and writing. There is a known issue that the Embedded Nulls will cause similar issue. Please refer to: BUG: Sequential File I/O Does Not Handle Embedded Nulls http://support.microsoft.com/?id=142246 If it is the cause, use the Replace function to replace NULL characters with "" before reading it with ReadLine. The code looks like: Dim l As Long Dim s As String Open "c:\test.txt" For Binary As #1 l = LOF(1) s = String$(l, 0) Get #1, , s s = Replace(s, vbNullChar, "") Seek #1, 1 Put #1, , s Close #1 2. We can use FileSystemObject to read and write the file. You can find the sample in the following url: Working With Files http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconmanipulatingfiles.asp Do you encounter similar problem if you are using FileSystemObject? 3. If they cannot address the problem, please send me a reproducible project and the sample data (including the file that has generated using your code) so that I can test it on my machine. If my understanding is not correct, or you have any concerns, please let me know. Thanks, Jian-Wei Yu Microsoft Developer Support jwyu@microsoft.com Satisfied customers are my top priority. Please let my manager or me know what you think of the level of service provided. You can send feedback to Microsoft Management mailto:managers@microsoft.com?subject=DSVFB_Feedback&body=Wen%20Yu or directly to my manager, Wen Yu at wenyu@microsoft.com. -------------------------------------------------------------------------------- chris clement Wed, Aug 18, 2004 at 4:22AM To: Jian-Wei Yu Hi Jian-Wei - I read the bug report about embedded nulls and it does seem relevant. The device that is being read from the com port is the source of these strings that I am parsing. To the best of my knowledge, the strings have no nulls, just digits 0-9, commas, and CRLF. To reproduce the problem, you would need the hardware device or a simulation program running on another pc. It is definitely intermittent but I saw it happen enough to try to work around it in my submitted code sample. I will try your remedies 1) and 2). Thanks, Chris [Quoted text hidden] -------------------------------------------------------------------------------- Jian-Wei Yu Wed, Aug 18, 2004 at 4:29AM Hi Chris, Thank you for your email. I am not sure if you have kept a copy of the files that were generated when the error occurred. If so, we can compare them with the other files and it may give us some useful information. Thanks, Jian-Wei Yu Microsoft Developer Support jwyu@microsoft.com Satisfied customers are my top priority. Please let my manager or me know what you think of the level of service provided. You can send feedback to Microsoft Management mailto:managers@microsoft.com?subject=DSVFB_Feedback&body=Wen%20Yu or directly to my manager, Wen Yu at wenyu@microsoft.com. [Quoted text hidden] -------------------------------------------------------------------------------- chris clement Wed, Aug 18, 2004 at 11:29AM To: Jian-Wei Yu Jian-Wei I have installed the patch 1) as shown below. This code runs once every 10 seconds, so there should be no timing issues. The code executes properly. Because the original problem was intermittent to begin with, I will distribute the repaired program to customers who reported the problem to me and wait to see if they have any more occurrances. I will consider the problem resolved but would like to be able to reopen if there is still a problem. As you can see in the code, the file "cp.txt" is just a temporary file that does not actually need to be permanently saved on the disk. Are there any parameters that could be used to just do all this in a memory buffer? It wouldn't save any time, but might make less "work" for the o/s. Thanks, Chris c1$ = MSComm1.Input 'A little Fortran-style formatting Open FileNameS + "cp.txt" For Output As 1 Print #1, c1$ Print #1, c1$ 'stupid MS bug Close 1 'SRZ040816002359: "Error 62 - input past end of file" Dim l As Long Dim s As String Open "c:\cp.txt" For Binary As #1 l = LOF(1) s = String$(l, 0) Get #1, , s s = Replace(s, vbNullChar, "") Seek #1, 1 Put #1, , s Close #1 '16,255,99999,99999 = 18 max mM 1 '1,0,0,0,0,0,0,10000 = 19 min mM 2 If Len(c1$) > 18 Then sw1 = 1 If sw1 = 0 Then Label3 = "mMI" If sw1 = 1 Then Label3 = "mMII" Open FileNameS + "cp.txt" For Input As 1 If sw1 = 0 Then Input #1, a, b, c, d If sw1 = 1 Then Input #1, a, b, c, d, e, f, g, h Close 1 'fix stupid MS bug - "a" comes in empty almost every time in a set of 16 If sw1 = 1 And h < 10000 Then a = b: b = c: c = d: d = e: e = f: f = g: g = h: h = 11111 End If [Quoted text hidden]