CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: input error

  1. #1
    Join Date
    Nov 1999
    Posts
    21

    input error

    I have a program which reads info from text files using the input command. The problem is that if there is no info in the file the program crashes. How can i stop this?


  2. #2
    Guest

    Re: input error

    Use error handler.
    Vlad


  3. #3
    Join Date
    Nov 1999
    Posts
    21

    Re: input error

    Thats all very well but dont error handlers let the prog crash any way, simply allowing u to give a differnt message as it does so. Besides, precisely how do i do this??


  4. #4

    Re: input error

    Use:

    'This forces the code to continue regardless of an error
    on error resume next

    then use err.number to determine the type of error.

    'This turns off error handling
    on error goto 0





    If you can search your help for the following
    on error goto
    on error resume next
    err

    I hope this helps


  5. #5
    Join Date
    Dec 1999
    Location
    VA, USA
    Posts
    8

    Re: input error

    Hi

    Check FileLen(Filename). If its zero then don't read the file.

    Hope that helps.

    Nandini


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured