Thread: How to check duplicate line in text file?

  1. #1
    Registered User
    Join Date
    Jan 2002

    Smile How to check duplicate line in text file?

    I want to chek duplicate line in text file


    If in "1.txt" has this data inside

    This above text file has duplicate line


    I want to write proram to check duplicate line.
    Do you know how to do that? (Now I can use CStdioFile (ReadString, WriteString) and show Messagebox but not have idea to do that.)

    Thank you for your answer.

  2. #2
    Registered User
    Join Date
    Jan 2002
    I want to show message box which display message duplicate or not duplicate.

  3. #3
    first, in the future, you may not want to ask if we know how to do it, as some smart alec will just post a "yes" for you. It could be rephrased "could someone help walk me through finding out how to do it" etc. Prelude posted a (really good) article/thread in the FAQ forum, and if you follow the rules/examples laid out in there, you will probably need a personal secretary to filter the incoming help (exagerating, but you get the point).

    Now, to the question. YOu could store them all in an STL containor, and use one of the functions there (i forget what it is, sorry) to delete all replica lines, or you could use another one to replace them all. Sorry that i can't explain exactly how to do this too well, but i believe others could help you should you want to take this road.
    GCC on Red Hat 8.1 (Primary)
    GCC on Mac OS X 10.2.4 (Secondary)

    MinGW on XP

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    A binary tree sounds like it might do the trick....
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 19
    Last Post: 05-30-2007, 05:47 PM
  2. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 02:59 PM
  3. reading a text file printing line number
    By bazzano in forum C Programming
    Replies: 4
    Last Post: 09-16-2005, 10:31 AM
  4. struct question
    By caduardo21 in forum Windows Programming
    Replies: 5
    Last Post: 01-31-2005, 04:49 PM
  5. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM