home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,069 of 10,840   
   J French to All   
   Re: Declaring variables and file for ran   
   09 Dec 04 13:40:19   
   
   XPost: comp.lang.basic.visual, comp.lang.basic.visual.misc   
   From: erewhon@nowhere.uk   
      
   On Thu, 9 Dec 2004 12:38:00 +0100, "Stefanie"    
   wrote:   
      
   >Steve,   
   >   
   >> As far as I can tell, Put will write a 2 byte length before writing a   
   >> variable length string to a file opened Random (UDT or not), which   
   >> allows Get to retrieve it correctly. The total record length would have   
   >> to be long enough for that. I don't believe you actually have to pad out   
   >> the string length unless you want to.   
   >   
   >Yes i read that too, but i don't understand how to do this:   
   >   
   >This are the variables declared in my module.   
   >   
   >    Type Record   
   >        vDateTime As String * 19   
   >        vFileName As String   
   >    End Type   
   >   
   >    Public RecVar As Record   
   >   
   >Using vFileName As String * 255 gives my enough for een full path, but most   
   >of the time it's wasting space.   
   >   
   >I use this for opening my file:   
   >   
   >    Open strFileName For Random As #Dnr Len = Len(RecVar)   
   >   
   >But it's gives an error. "Bad record lenght"   
   >   
   >Maybe somebody can offer me an example how to use the aforesaid.   
      
   Look at the example I posted earlier in this thread   
      
   If you are interested in not wasting space then look carefully at   
   opening the file in Binary mode rather than Random mode   
      
   Have a careful look at the Seek Statement, and more importantly the   
   Seek Function.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca