Crypto Error

Saj

Active Member
Licensed User
I've put a small program together to explore crypto. I can seem to apply crypto but not the reverse. In the attached program press 'Create File' followed by 'Read File' to see the error.
 

Attachments

  • BinaryCryptoTestProg5_toForum.sbp
    3.1 KB · Views: 219

Saj

Active Member
Licensed User
So, can you suggest what I should do to save an array bytes to a file such that it can be read back safely?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
If you are writing several arrays one after another then you later need a way to separate the arrays when reading. In this case you can write the array size before each array and then when you read the data you first read the length and then know how many bytes you should read.
If you are only writing a single array to a file then it is simpler as you only need to read the whole file.
 

Saj

Active Member
Licensed User
Thanks Erel. I've had a go at what you suggested. I think i'm getting an error reading an array. Could you take another look?
 

Attachments

  • BinaryCryptoTestProg6_toForum.sbp
    3.9 KB · Views: 214

Saj

Active Member
Licensed User
Hi Erel

I'm getting an error (line 100) which seems to be related to reading the number of saved bytes in the binary file - as you previously suggested.

Thanks
 

Attachments

  • BinaryCryptoTestProg8_toForum.sbp
    4.8 KB · Views: 233
  • error.jpg
    error.jpg
    28.2 KB · Views: 217

Saj

Active Member
Licensed User
Whats the syntax for redeclaring the size of an array on the fly after it has been declared in Globals? Ive tried 'Dim buffer(32)' and it don't like it.
 
Top