Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: Bolt on March 31, 2020, 12:24:47 PM

Title: FILEREAD as a buffer
Post by: Bolt 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?
Title: Re: FILEREAD as a buffer
Post by: franji1 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?
Title: Re: FILEREAD as a buffer
Post by: Bolt on March 31, 2020, 01:05:50 PM
I was envisioning it as each buffer line followed by a carriage return line feed
Title: Re: FILEREAD as a buffer
Post by: franji1 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
Title: Re: FILEREAD as a buffer
Post by: ATU 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.
Title: Re: FILEREAD as a buffer
Post by: Bolt 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.