CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2006
    Posts
    8

    Need Help output repeating last line

    Hi

    I m reading a file that ends with a blank line and when i do the output it repeats the line before the blank 2 times.

    I am using


    ifstream infile;

    infile.open ("FICHEIROS_DE_ENTRADA.TXT", ifstream::in);

    while (infile.peek() != '0' && !infile.eof()){

    infile>>i;

    To read the input...
    Can anyone help me not to repeat the last line?

    Thank's
    Ricardo

  2. #2
    Join Date
    Sep 2005
    Location
    United States
    Posts
    799

    Re: Need Help output repeating last line

    Phillip's second suggestion is the the best way to do this.

    I highly recommend using it
    Please rate my post if you felt it was helpful

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