Probably not a feature request

Give it a try, it costs you nothing !
Post Reply
bugs
Posts: 142
Joined: Mon Feb 08, 2021 10:10 pm
Location: Scotland
Has thanked: 44 times
Been thanked: 50 times

Probably not a feature request

Post by bugs »

From the help file:-

This command read 512 bytes from the file data.bin starting from the file position 123 in the buffer 0:
FILE.READ_IOBUFF(0), “/data.bin”, 123, 512

There does not seem to be a matching FILE.WRITE_IOBUFF command to place the iobuffer into the particular file locations.

I was attempting to answer the recent EEPROM question by writing two functions {sub EEPROMwrite(addr,byte) and sub EEPROMread(addr,byte) } using a file as an EEPROM substitute. The read function worked as expected but could not find a suitable write function.
I could read the whole file then modify the buffer and write the whole file but thought there might have been a simpler way.

It is not important as I have no application in mind - it was just an exercise. :)
User avatar
cicciocb
Site Admin
Posts: 1889
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 405 times
Been thanked: 1261 times
Contact:

Re: Probably not a feature request

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue Jul 13, 2021 1:06 pm From the help file:-

This command read 512 bytes from the file data.bin starting from the file position 123 in the buffer 0:
FILE.READ_IOBUFF(0), “/data.bin”, 123, 512

There does not seem to be a matching FILE.WRITE_IOBUFF command to place the iobuffer into the particular file locations.

I was attempting to answer the recent EEPROM question by writing two functions {sub EEPROMwrite(addr,byte) and sub EEPROMread(addr,byte) } using a file as an EEPROM substitute. The read function worked as expected but could not find a suitable write function.
I could read the whole file then modify the buffer and write the whole file but thought there might have been a simpler way.

It is not important as I have no application in mind - it was just an exercise. :)
HI Bugs,
yes this can be probably implemented, the problem will be the syntax of the command :

Something like this ?

This command write 12 bytes from the buffer 1 starting from the position 64 to the file "file.bin" to the file position 123 :

FILE.WRITE_IOBUFF(1, 64, 12), “file.bin”, 123
bugs
Posts: 142
Joined: Mon Feb 08, 2021 10:10 pm
Location: Scotland
Has thanked: 44 times
Been thanked: 50 times

Re: Probably not a feature request

Post by bugs »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue Jul 13, 2021 3:42 pm
This command write 12 bytes from the buffer 1 starting from the position 64 to the file "file.bin" to the file position 123 :

FILE.WRITE_IOBUFF(1, 64, 12), “file.bin”, 123
I had not thought that far ahead - but that seems to match with all the other iobuffer commands.
However, please don't waste any time or flash space unless you think there might be a useful application for it.
Post Reply