Results 1 to 7 of 7

Thread: Writing text to the End of a File

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    HI,

    I need some smart guru to show
    me how to write text to a the
    line after the end of a file.
    I am so confused and do not
    understand how to.

    Thanks.

    Evan

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    if you mean AT the end and not AFTER the end it's:
    Code:
    Open "FileName" for Append As #1

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    Theres a file that says

    HI

    and I want to make it say

    HI
    How are you

    And I really dont know anything
    I need more code.. like all of it
    please.

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    then:
    Code:
    Open "FileWithHI" For Append As #1
    Print #1, "How are you"
    Close #1
    that's all it takes.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    Thanks alot

  6. #6
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    A little info on txt files

    Code:
    'writing or reading data to or from a text file
    'open for append adds the data to the end of file
    'open for input opens the file for read only
    'open for output opens the file and overwrites the file
    '
    '
    Private Sub Command1_Click()
    
    'this is the number of your file
    Dim intFilenum As Integer
    
    'set it to the next available free number
    intFilenum = FreeFile
    
    'this is your filename
    Dim strFile As String
    strFile = "A:\myfile.txt"
    
    'this is the text you want to save (textbox)
    Dim strText As String
    strText = Text1.Text
    
    'open the file for writing to as next freefile number
    
    Open strFile For Append As intFilenum  'see above options
    'write to the file
        Write #intFilenum, strText  'to read use  [input #filenum,strtext]
    
    'close the file
    Close intFilenum
        
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    Thanks alot!

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