Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

Error message : Input past end of file

Hello group,

I have a form which shows log file contents, sometimes when I click a button to open and view the log file it raises this error message:

   "Input past end of file  (error code 62)"

What cuases this and how should I solve it?

Regards,
ak
0
akohan
Asked:
akohan
2 Solutions
 
Anthony2000Commented:
Have you seen this link on Microsoft's website?

http://support.microsoft.com/kb/82001
0
 
Robberbaron (robr)Commented:
you will need to check for end of file BEFORE asking for the data....

the MS link gives the general idea.

My process....


Sub CkeckLog_Click()
 dim logfilename as string, ffn as integer , sLogData as string
 logfilename = "test1.log"
  '1. check if file exists
    if not exists then
        MsgBox "LogFile" & logfilename & " Not found"
        exit sub
    end if
 '2. get the data
   ffn = freefile   'get a new filehandle. avoids errors/clashes
   open logfilename for input as #ffn
       do while not eof(ffn)
          Line input #ffn, sLogdata
          'display it.
       loop
   close #ffn

End sub


you probably have most of this but are not checking for EOF before reading data.
Particularly if your logfile has a header string but then not checking for each dtaa line.

I tend to NOT use INPUT #ffm, x,y,z  because that can cause the error if not enough data is available.  I read all the line (LINE INPUT) and SPLIT it up so i can check if all data is expected.
0
 
akohanAuthor Commented:


Thanks to all.

Regards,
ak
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now