Results 1 to 5 of 5

Thread: Read text file and write to another file

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    Read text file and write to another file

    The original file format is like that:

    Header
    2.85667000
    99.70000000
    4.01666940
    101.46667000

    2
    Decimal
    1.01.33
    Some description
    EndHeader
    START 43, L, 174=0;133=300000
    100.81888000 3.85663000
    100.81778000 3.85625000
    100.80883000 3.85519000

    STOP
    START 43, L, 174=2;133=300000
    101.29401000 3.20013000
    101.29359000 3.20232000
    101.29134000 3.20748000

    STOP

    i need to change it to another kind of format as below and save as another file by using visual basic 6.

    2.85667000
    99.70000000
    4.01666940
    101.46667000
    Decimal
    100.81888000 3.85663000 174=0
    100.81778000 3.85625000 174=0
    100.80883000 3.85519000 174=0
    101.29401000 3.20013000 174=2
    101.29359000 3.20232000 174=2
    101.29134000 3.20748000 174=2
    Last edited by junlo; Jan 30th, 2007 at 08:11 AM.

  2. #2
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: Read text file and write to another file

    My suggestion is read the text file line by line and parse it and write it to a new file.

    Read text file contents (in four ways)

    How to write text in a given text file (in two ways)
    Last edited by cssriraman; Mar 8th, 2007 at 05:10 PM.
    CS

  3. #3
    Addicted Member
    Join Date
    Nov 2006
    Posts
    132

    Re: Read text file and write to another file

    What is your question?

  4. #4
    Hyperactive Member
    Join Date
    Oct 2006
    Location
    USA
    Posts
    476

    Re: Read text file and write to another file

    Quote Originally Posted by cssriraman
    My suggestion is read the text file line by line and parse it and write it to a new file.
    How do you do that?

    I read a couple of the links in your sig and didn't find them helpful since I don't know the first thing about this.

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Read text file and write to another file

    Quote Originally Posted by disruptivehair
    How do you do that?

    I read a couple of the links in your sig and didn't find them helpful since I don't know the first thing about this.
    Line Input, although it's about the slowest way to read a file ever invented.

    The binary mode method demonstrated on his page is the quickest. Then you can use the Spit function to break it up into an array of lines.

    To write to a file, open it in binary mode using the Access Write modifier, and use the Put statement.

    Also, your CDs are sitting on my desk wrapped and ready to go, should be on their way in a day or two.

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