I am trying to dump some info to a file on MD1 with FWRITC and PUT / WRITE. It is working just fine, everything is as expected.
However, I am also trying to read from the same file using FOPENA and GET and have hit a wall.
The FOPENA is working just fine, as is CLOSE A.
But no matter what variations on GET I use, I receive an error 2323 (Buffer Over).
I have tried every syntax I can imagine, including 'GET 1' but I still receive the error.
The file format seems to be good, it is (at this point) simply 2 sets of numbers, like this:
4.8556496, 3422345
The manuals do not do a very good job of explaining the error other than to say "The number of received data sets is larger than read pointer value."
Has anyone had success with reading from a local file?
Just an example of some working code would be very helpful; I'm pretty certain I am missing something obvious.
Thanks.
Edit - changed a word.
Last edited by ghyman; 04-24-2015 at 07:57 AM.
Reason: Extra word
Writing is the easy part... FWRITC MD1: takes care of that.
Reading, however, took me a few steps before I found the issue.
FOPENA MD1: opens the file for input,
then the control must receive a pointer to the input channel so that GET commands know where to look for the input... this is done by READ A
Once the READ A is given, then the first line of the file can be input using GET. In the example below, GET ,26 will read in the first 26 characters of the first line and do nothing with it.
Following this, the next READ A is saying "OK, we're reading in a new line on channel A"
Then, each GET command will either read in and ignore characters (GET ,2 reads 2 characters, GET V11,2 reads in the next 2 characters and writes them into V11, etc.)
FWRITC MD1:fname.TXT;C
PUT ,4
PUT '** '
PUT 'TOOL OFFSET DATA'
PUT ' **'
PUT $0D0A
PUT 'N='
PUT V1,2
PUT ' X='
PUT VTOFX[V1],8
PUT ' Z='
PUT VTOFZ[V1],8
PUT $0D0A
WRITE C
CLOSE C
M0
FOPENA MD1:fname.TXT
READ A
GET ,26
READ A
GET ,2
GET V11,2
GET ,3
GET V12,8
GET ,3
GET V13,8
CLOSE A
M2
I've been out in the shop playing with this.
Very cool function to tap into.
I think the control is going to be able to give us a certain amount of built-in 'intelligence.' (Maybe not SkyNet, but one step closer!!)