XPost: comp.lang.basic.visual, comp.lang.basic.visual.misc   
   From: erewhon@nowhere.uk   
      
   On Mon, 6 Dec 2004 11:49:27 +0100, "Stefanie"    
   wrote:   
      
   >Steve,   
   >   
   >Thats the same as writing data to the file using Put, right ?   
   >   
      
   I could not see your first post   
      
   Below is a demo of Random Access using UDTs containing variable length   
   strings - the Record Length that it is opened with has to be large   
   enough.   
   - I would not do it like this personally   
      
   Option Explicit   
      
   Private Type TRec   
    L As Long   
    S As String   
    I As Integer   
   End Type   
      
   Private Sub Command1_Click()   
    Dim Rec As TRec, Channel%   
      
    Rec.L = -1   
    Rec.S = "Test String"   
    Rec.I = -1   
      
    Channel = FreeFile   
    Open App.Path + "\test.dat" For Random As Channel Len = 200   
    Put #Channel, 1, Rec   
    Close #Channel   
      
   End Sub   
      
   Private Sub Command2_Click()   
    Dim Rec As TRec, Channel%   
      
    Channel = FreeFile   
    Open App.Path + "\test.dat" For Random As Channel Len = 200   
    Get #Channel, 1, Rec   
    Close #Channel   
    Me.Print Rec.L, Rec.S, Rec.I   
      
   End Sub   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|