Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

read a string from ".txt"

i need to read a string from a txt file.
and i need to update that file with a new string
how i can?
  • 2
1 Solution
methhhAuthor Commented:
thanks =) !!
Can you explain more of what you are trying to accomplish.  It can really help with your answer.

If you are trying to simply keep information for your program you should really use the "SaveSetting" feature to save to the Registry.  This would allow for you to save that information over and over and make changes without having to use the FileSystemObject.

Here is a link on how to do that.


If you HAVE to work with this file instead of the registry save, you can use the FileSystemObject with the TextStream Object (both searchable on microsoft.com).  

You would make a simple FileSystemObject and then open the file.  This opening becomes a TextStream object and you have a method called "readline" that should give you the information you need.  You also have a "writeline" method that can put the new information in that you need to save.

Hope this helps.
I’m not sure what exactly you are trying to do, you can read a txt file using the Input command (I don’t know why but I’m assuming it’s a comma delimited) example:

Open app.path & “\whateveryourfileiscalled” for input as #1
Do while not eof(1)
     Input #1 strone, strtwo…

Then to write just open the file for output or if you want to add to it open it for append.
methhhAuthor Commented:
thanks dmstrat!!! =)

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now