Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. File Creation in share mode in VC++

File Creation in share mode in VC++

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorial
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    neeraja31
    wrote on last edited by
    #1

    Hi All, I need to remove duplicate lines in a text file, need to use that output file for other functions. Can any one suggest me how to remove the duplicate lines in a text file

    L S 2 Replies Last reply
    0
    • N neeraja31

      Hi All, I need to remove duplicate lines in a text file, need to use that output file for other functions. Can any one suggest me how to remove the duplicate lines in a text file

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      neeraja31 wrote:

      Can any one suggest me how to remove the duplicate lines in a text file

      Read the file, sort the contents, discard the duplicates and write the remaining lines to a new file. Or did I misunderstand the question?

      N 1 Reply Last reply
      0
      • L Lost User

        neeraja31 wrote:

        Can any one suggest me how to remove the duplicate lines in a text file

        Read the file, sort the contents, discard the duplicates and write the remaining lines to a new file. Or did I misunderstand the question?

        N Offline
        N Offline
        neeraja31
        wrote on last edited by
        #3

        Hi Thanks for yuor reply. How can i sort the text file using C++ code. If you have any piece of code please expain me with that

        L D 2 Replies Last reply
        0
        • N neeraja31

          Hi All, I need to remove duplicate lines in a text file, need to use that output file for other functions. Can any one suggest me how to remove the duplicate lines in a text file

          S Offline
          S Offline
          sunlin7
          wrote on last edited by
          #4

          read text lines from file and save them to vector(or other container), then sort the vector and unique it.

          N 1 Reply Last reply
          0
          • S sunlin7

            read text lines from file and save them to vector(or other container), then sort the vector and unique it.

            N Offline
            N Offline
            neeraja31
            wrote on last edited by
            #5

            Please give me te\he piece of code to read from vector, confirm me whether that will work on win32 VC++ project

            D 1 Reply Last reply
            0
            • N neeraja31

              Hi Thanks for yuor reply. How can i sort the text file using C++ code. If you have any piece of code please expain me with that

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              neeraja31 wrote:

              How can i sort the text file using C++ code.

              The qsort() function provides a simple sort mechanism, or you could use the STL vector<> type. See the MSDN documentation for complete details.

              1 Reply Last reply
              0
              • N neeraja31

                Hi Thanks for yuor reply. How can i sort the text file using C++ code. If you have any piece of code please expain me with that

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                neeraja31 wrote:

                How can i sort the text file using C++ code.

                How about std::sort()?

                "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                1 Reply Last reply
                0
                • N neeraja31

                  Please give me te\he piece of code to read from vector, confirm me whether that will work on win32 VC++ project

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  One example, assuming you are storing ints in the vector, looks like:

                  vector<int> nums;
                  for (vector<int>::iterator i = nums.begin(); i != nums.end(); i++)
                  cout << *i << endl;;

                  "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups