CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    Text files reading and writing

    Has anyone got an idea/ code of how I can read a text file line by line, format each line by adding 'F' at the end of each line and writing it to another file, all in one procedure. I come from a C background and dont know VB...Please help

    email me with an answer at [email protected]


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Text files reading and writing


    dim hIn as integer
    dim hOut as integer
    hIn= freefile
    open "inputfile" for input as #hIn
    hOut = freefile
    open "outputfile" for output as #hOut
    dim strLine as string
    do while not eof(hIn)
    line input #hIn, strLine
    print #hOut, strLine & "F"
    Loop
    close hIn
    close hOut




    replace the file names with parameters


  3. #3
    Join Date
    Jul 1999
    Posts
    4

    Re: Text files reading and writing

    Open one file for input and another for output (OPEN). Then use while not End of File (WHILE NOT EOF(fh))) to read in each line from the input file. Use LINE INPUT to read one full line. Then append the "F" using & operator. (sInLine & "F")
    Then Print the resulting line to the output file.


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

Featured