Results 1 to 12 of 12

Thread: problem with eof...

Hybrid View

  1. #1
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: problem with eof...

    I haven't used "Input " that way in years. If I remember correctly, you are getting two values from the file: slang & means. I don't see where those are declared but am assuming they are strings. If I do recall correctly, then if your file doesn't contain pairs of values throughout the file, you will get the error. This is because your code is trying to input slang, which works, but there is no more data to input means -- error. I would imagine your error is probably caused by a blank line within your file. Worth a check. If you can't figure it out, you might want to post your file
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  2. #2
    Hyperactive Member Quiver318's Avatar
    Join Date
    Sep 2007
    Posts
    260

    Re: problem with eof...

    The Input command will read a line until it reaches CRLF (noting the end of the line), and it will then move on to the next line. If the last line in your file does not have CRLF, the routine will read past the end of file and will throw an error.

    To fix this, open your list file in a common editor like Notepad. Go to the very last character of the very last line, and then press the Enter key! This will create a a CRLF at the end of that line and your cursor will jump to the next line below it. Save your file, and then run your routine. It should work now.

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: problem with eof...

    Quote Originally Posted by Quiver318 View Post
    The Input command will read a line until it reaches CRLF (noting the end of the line), and it will then move on to the next line. If the last line in your file does not have CRLF, the routine will read past the end of file and will throw an error.
    Not quite. Line Input #n will read an entire line. The code posted in #1 above is not using Line Input.

    Edited: It really depends on the formatting of the text/data within the file.
    Example: Apples, Bananas, Grapes :: Input #n, strFruit will read each word individually even if they are on the same line
    Example: Apples Bananas Grapes :: Input #n, strFruit will read entire line in this case; same result as using Line Input
    Last edited by LaVolpe; Jun 19th, 2009 at 06:12 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4
    Hyperactive Member Quiver318's Avatar
    Join Date
    Sep 2007
    Posts
    260

    Re: problem with eof...

    Quote Originally Posted by LaVolpe View Post
    Not quite. Line Input #n will read an entire line. The code posted in #1 above is not using Line Input.
    You are quite right. I had confused Input with LineInput. Sometimes all these commands run around in my head until I cannot sleep at night. Sorry for the confusion.

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