Random Access File puzzle...

  • Thread starter Thread starter AncientTeacher
  • Start date Start date
A

AncientTeacher

Guest
Structure word
Dim item As String
End Structure
__________________________________________
Dim entry As word
If ListBox1.Items.Count = 0 Then Exit Sub
FileOpen(1, "C:\A+\DICTIONARY.RND", OpenMode.Random, , , 38)
For x = 0 To ListBox1.Items.Count - 1
ListBox1.SetSelected(x, True)
entry.item = ListBox1.SelectedItem
FilePut(1, entry, Len(entry.item))
Debug.Print(ListBox1.SelectedItem)
Next
FileClose(1)



Hello All,

The above code is meant to convert a regular text file to a random access file.

First, the resulting file is does not contain more than a fraction of the entries. Secondly, I cant properly access them using FileGet. I have a very old school byte editor that I made years ago in QuickBasic that lets me examine the files byte by byte. I include a snapshot here so that you can see the scattered fragments of data the file contains. [Broken External Image]:https://www.facebook.com/photo.php?...807295271.1073741825.705430270&type=1&theater


I dont know if the picture will show up.


Does anyone see any fundamental error Im making in this code that is preventing the transfer of all the data? You will notice that I have a debug.print line which I used to check that all the items in my listbox (which contains all the dictionary entries) where being processed. They are. So any thoughts about whats wrong here?

Continue reading...
 
Back
Top