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#
  4. Saving from one txt file into another one problem?

Saving from one txt file into another one problem?

Scheduled Pinned Locked Moved C#
helpquestion
4 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.
  • K Offline
    K Offline
    Khoramdin
    wrote on last edited by
    #1

    Hello everyone, I need some idea since I am running out of my own and haven't been able to get it working. I have a file called temp.txt which hold temparary data and will be deleted at the end of the Windows Application life. I have another file called perm.txt which is similar to the temp.txt file but it hold the saved data. In order to avoid multipler data registration I would like to check to see if a particular data from temp.txt file has already been registered or not. If it hasn't then I will go ahead to save/register it into save.txt file. That is if the user choses to Save its temp.txt content by clicking on the SAVE button. Any suggestion in this issue will be greatdly appriciated. Thank you very much and have a great day. Khoramdin

    D W N 3 Replies Last reply
    0
    • K Khoramdin

      Hello everyone, I need some idea since I am running out of my own and haven't been able to get it working. I have a file called temp.txt which hold temparary data and will be deleted at the end of the Windows Application life. I have another file called perm.txt which is similar to the temp.txt file but it hold the saved data. In order to avoid multipler data registration I would like to check to see if a particular data from temp.txt file has already been registered or not. If it hasn't then I will go ahead to save/register it into save.txt file. That is if the user choses to Save its temp.txt content by clicking on the SAVE button. Any suggestion in this issue will be greatdly appriciated. Thank you very much and have a great day. Khoramdin

      D Offline
      D Offline
      darkcalin
      wrote on last edited by
      #2

      post the code if you want some help

      1 Reply Last reply
      0
      • K Khoramdin

        Hello everyone, I need some idea since I am running out of my own and haven't been able to get it working. I have a file called temp.txt which hold temparary data and will be deleted at the end of the Windows Application life. I have another file called perm.txt which is similar to the temp.txt file but it hold the saved data. In order to avoid multipler data registration I would like to check to see if a particular data from temp.txt file has already been registered or not. If it hasn't then I will go ahead to save/register it into save.txt file. That is if the user choses to Save its temp.txt content by clicking on the SAVE button. Any suggestion in this issue will be greatdly appriciated. Thank you very much and have a great day. Khoramdin

        W Offline
        W Offline
        Wayne Phipps
        wrote on last edited by
        #3

        I don't quite understand the problem/question. As I understand the situation: You save data in a temporary file which is deleted when the application exits. There is another permanent file where the data in the temporary file is written/moved as long at the data doesn't already exist in the permanent file. This would require your code to perform the following: Read a record from the temporary file. Read the contents of the permanent file searching for a matching record. If no record is found in the permanent file, append the permantent file with the new record. Depending on the size of the files and number of records, you may be able to read both files into memory when making comparisons and after any additions, simply write out a new permanent file from the records in memory.

        Regards Wayne Phipps ____________ Time is the greatest teacher... unfortunately, it kills all of its students View my Blog

        1 Reply Last reply
        0
        • K Khoramdin

          Hello everyone, I need some idea since I am running out of my own and haven't been able to get it working. I have a file called temp.txt which hold temparary data and will be deleted at the end of the Windows Application life. I have another file called perm.txt which is similar to the temp.txt file but it hold the saved data. In order to avoid multipler data registration I would like to check to see if a particular data from temp.txt file has already been registered or not. If it hasn't then I will go ahead to save/register it into save.txt file. That is if the user choses to Save its temp.txt content by clicking on the SAVE button. Any suggestion in this issue will be greatdly appriciated. Thank you very much and have a great day. Khoramdin

          N Offline
          N Offline
          Nader Elshehabi
          wrote on last edited by
          #4

          In addition to what Wayne Phipps said, I'd suggest that you store the records as Hash codes in a HashTable. This way you can compare small integers instead of large records, which could boost your performance dramatically.

          Regards:rose:

          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