Bottom line, very technical all you rocket scientists but great background information to better understand the differences. Fortunately, although I need to learn correct coding the program I’m rewriting is a complete rewrite for a Home Automation System that has crunched away 24/7 for 15 plus years which needs less glorious code and error checking. It was originally written in the Real Basic 4.5 days and I haven’t coded since. Most likely appalling code not understanding opps structure at that time. I hope to take more time understanding classes and all the other crazy stuff like inheritance, casting, class interfaces, etc. I will have many questions for you brilliant coders, most of the time looking for a bailout with a code examples if I can squeeze it out of you.
Markus, you gave me the code I needed to make it work, I just experimented replacing the .bin file with a .txt and then saved variant data to pStings. I can now use a text editor to see the data. It seems to work but I’m open as to why I shouldn’t or any improvements to consider. Remember I’m the old guy trying to learn new tricks. Thanks to all.
This is where I’m at with a test using a BinaryStream and it seems to work:
WRITE
[code]Var value,value2,value3,value4 As variant
Var Bolval as Boolean = true
Value2 = “Cats and Dogs” Rem String
Value3 = 123456 Rem Integer
Value4 = BolVal Rem Boolean value
Value = Value2 + ", " +Value3 + ", " +Value4
Var path As FolderItem = SpecialFolder.Desktop.Child (“HC Prefs Folder 2”)
If path.Exists = False Then path.CreateFolder
Var file As FolderItem = path.Child( “Menu Prefs” )
Var b As BinaryStream = BinaryStream.Create(file,True) 'Big Endian by default
b.WritePstring(value)
b.Close
[/code]
READ
[code]Var value As variant
Var path As FolderItem = SpecialFolder.Desktop.Child (“HC Prefs Folder 2”)
If path.Exists = False Then path.CreateFolder
Var file As FolderItem = path.Child( “Menu Prefs” )
If file.Exists = False Then 'Return False 'no file here
Rem add code
end
Var b As BinaryStream = BinaryStream.Open(file) 'Big Endian by default
msgbox b.ReadPstring
b.Close[/code]