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

Threaded View

  1. #5
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: open, read, write file binary ?

    I forgot: To write records you need the same declaration of the record type.
    Code:
      Dim Rec As MyRecordType
      Open FileName For Random As #1 Len = Len(CurRecord)
      Rec.Name = "wahwah"
      Rec.Address = "Somewhere"
      Rec.PhoneNumber = "1234"
      Put #1, , Rec
      Close #1
    This would write a new record to the file. After Open, it would start writing at the first record.
    Put allows you always to specify the recordnumber, so as you can overwrite any record even in the middle of a file.
    And there is the Seek statement to put your current record pointer to a specific record.
    Last edited by WoF; January 27th, 2010 at 09:41 AM.

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