News:

  • August 24, 2026, 07:36:26 AM

Login with username, password and session length

Author Topic: FILEREAD as a buffer  (Read 7459 times)

Bolt

  • Hero Member
  • *****
  • Posts: 598
FILEREAD as a buffer
« on: March 31, 2020, 12:24:47 PM »
I'd like to treat a file as a buffer, by writing to it (when my FIFO buffer gets full) and then reading back out of it when ready to do so.  I have figured the FILEWRITE portion out, and can do a FILEREAD of the first row of data ($0D$0A), but am at a loss on how to proceed from there, either drop that row, or don't read it next time around.  I think FILETRUNC works in reverse of what I need.

Am I going about this the right way or need to look at something else?

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: FILEREAD as a buffer
« Reply #1 on: March 31, 2020, 12:40:17 PM »
Is a TEXT LINE in your file is a SINGLE RECORD from your FIFO?
OR
Is it one huge text line with ALL the FIFO records, followed by a single CR/LF?

Bolt

  • Hero Member
  • *****
  • Posts: 598
Re: FILEREAD as a buffer
« Reply #2 on: March 31, 2020, 01:05:50 PM »
I was envisioning it as each buffer line followed by a carriage return line feed

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: FILEREAD as a buffer
« Reply #3 on: March 31, 2020, 01:21:02 PM »
Q1. When you say "buffer line" you mean "FIFO record".

Q2. Is the FIFO strings or is it a UDT or a simple numeric type.  The first doesn't need any parsing, the 2nd and 3rd need some kind of parsing for each text line to convert it from text to numeric

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: FILEREAD as a buffer
« Reply #4 on: March 31, 2020, 01:26:19 PM »
I did something similar, not on BRX, but the commands were almost the same. I needed to buffer a bunch of strings.   Not sure how fast you need to access the data, but rather than trying to keep track of position in the file, I used separate numbered files for each entry It was much easier.  It is slower, but you do have the advantage of using the RAM file.

Bolt

  • Hero Member
  • *****
  • Posts: 598
Re: FILEREAD as a buffer
« Reply #5 on: March 31, 2020, 02:05:12 PM »
Sorry for being vague.

Yes, each line of the text file would be equivalent to a record in a FIFO Buffer.

Each FIFO record is a string.

I'm basically wanting to create an overflow area for a buffer consisting of SL strings.  The buffer posts to a server.  Due to memory limitations, I can't make the buffer large enough to survive potential network failures.