Results 1 to 2 of 2

Thread: Change the contents of a text file [VC++6]

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2003
    Posts
    308

    Question Change the contents of a text file [VC++6]

    Let me try to explain what I am trying to accomplish, and please if you have any suggestions or comments feel free to post them as I am pretty sure this is NOT the best way to solve my problem...

    In a folder I have a file "Packages.txt" that will contain information such as:
    Package2
    Package10
    Package3
    Package290
    In that same folder I will have a list of files that correspond to the names in the "Packages.txt" file, such as "Package2.zip", Package3.zip", etc...

    What I need to accomplish is:
    - Open Text File and read in the first line (in this case "Package2") & then consume the line (remove it?)
    - Apply Package2
    - Reboot
    - Open Text File and read in the first line (in this case "Package10") & then consume the line (remove it?)
    - Apply Package10
    - Reboot
    - Open Text File and read in the first line (in this case "Package3") & then consume the line (remove it?)
    - Apply Package3
    - Reboot
    ... etc ...
    So the text file will dictate the order in which to apply the files in the folder ...
    Problem is the REBOOT that occurs after applying a package - as it stands (this is where I need help) the text file information doesn't get consumed and therefore "Package2" is always the first line to be read, I need a way to, after reading that line, removing it so the first line becomes "Package10" and so on ... kind of hard to explain ...

    Now - this doesn't need to be a TEXT file, just something very simple to fill out and deploy to specify the order in which to apply the packages...
    If anyone has any better suggestions...

    Any help would be much appreciated.
    Thanks,

  2. #2
    Fanatic Member twanvl's Avatar
    Join Date
    Dec 2001
    Posts
    771

    Re: Change the contents of a text file [VC++6]

    Why on earth do you need to reboot after installing each package?

    I would suggest writing a new file containing a list of everything that is installed, so:
    - read "package2" from "todo" text file
    - write "package2" to "done" text file
    - install "package2"
    - if you insist, reboot
    - read "package2" from "todo" text file
    - check "done" text file, it is already done, so skip it
    - read "package10" from "todo" text file
    - write "package10" to "done" text file
    - install, reboot
    - etc.

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