News:

  • October 10, 2026, 06:39:38 PM

Login with username, password and session length

Author Topic: FILEREAD/FILEWRITE  (Read 6669 times)

JeffS

  • Hero Member
  • *****
  • Posts: 113
FILEREAD/FILEWRITE
« on: June 22, 2020, 12:40:02 PM »
When using the byte buffer option is it possible to move more than 1024 characters or is there something in the background that prevents this? Right now if I enter anything higher than 1024 I get an error.  My purpose in using a byte buffer is so that I can move more than 1024 bytes worth of data around.  So far this works with JSONBUILD and HTTPCMD commands with byte values up to 65535. 

I want to back up my built JSON structure to the SD card as a log that can be retrieved later if communications are interrupted. I could use multiple sequential reads to eventually pull out one data set, but would love to do it in one go if possible.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: FILEREAD/FILEWRITE
« Reply #1 on: June 22, 2020, 12:46:22 PM »
When using the byte buffer option is it possible to move more than 1024 characters or is there something in the background that prevents this? Right now if I enter anything higher than 1024 I get an error.  My purpose in using a byte buffer is so that I can move more than 1024 bytes worth of data around.  So far this works with JSONBUILD and HTTPCMD commands with byte values up to 65535. 

I want to back up my built JSON structure to the SD card as a log that can be retrieved later if communications are interrupted. I could use multiple sequential reads to eventually pull out one data set, but would love to do it in one go if possible.

Not in a single call. Ideally you should be doing things like this from a program block in stages. Loop through a couple of stages writing the max of 1024 or the bytes remaining, then on to the next part. I've done files well over 1MB this way.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

JeffS

  • Hero Member
  • *****
  • Posts: 113
Re: FILEREAD/FILEWRITE
« Reply #2 on: June 22, 2020, 01:12:52 PM »
Fair enough, really just checking it wasn't something overlooked for the byte buffer option.  Sounds like it isn't so I will build it with multiple reads/writes.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: FILEREAD/FILEWRITE
« Reply #3 on: June 22, 2020, 01:18:18 PM »
Fair enough, really just checking it wasn't something overlooked for the byte buffer option.  Sounds like it isn't so I will build it with multiple reads/writes.

It's a buffering issue at the driver level. None of the intermediate buffers for comm or file system are greater than 1024. It would probably be possible to work around for file system drivers, but it isn't trivial.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO