How to rename textfile


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: How to rename textfile

  1. #1
    Join Date
    Oct 2004
    Posts
    102

    How to rename textfile

    I found that I could not delete lines of my comma delimited text file using the ISAM driver. As a work around I've created a loop which searches for text matching the line to be deleted. Each line is examined, if the text does not match, it's printed to a temp text file if does match, it loops back to continue printing the rest of the lines to the tempfile which is then closed.

    Now I need to either rename the temp file as the permanant file or find a way to overwrite the contents of the temp file to the permanant file. Suggestions?

  2. #2
    Join Date
    Dec 2004
    Location
    México DF
    Posts
    127
    To rename a file in VB code use Name directive:

    Name <current file> As <target file>

    HTH,

    mc

  3. #3
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    You can use VB's Kill statement to delete the permanent file, then the Name statement to rename the temp file.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  4. #4
    Join Date
    Oct 2004
    Posts
    102
    Thank you both for your replies. Those commands should be very useful. I've suddenly hit another bug (that wasn't there before) but I'll save that problem for another post.

    Thanks Again!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center