Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Read/write data to a specific location within the file


'read 20 bytes starting at position 100
Dim InputString As String * 20
Open FileName For Binary As #1
  Get #1, 100, InputString
Close #1

'or read as a byte array
Dim InputString(20) As Byte
Open FileName For Binary As #1
  Get #1, 100, InputString
Close #1

'write 10 bytes to position 50
OutputString = "0123456789"
Open FileName For Binary As #1
  Put #1, 50, OutputString
Close #1