Thank you SkyeFire - I think that works!! Do you work for Kuka or something??
No, I just did a lot of KRL programming for about 20 years.
When I get to the CWRITE - "krl_fgets" process, I get an error message number -11, "At least one function parameters have an invalid value."
Hm... it's been a long time. The module I've attached is the most advanced one using FGETS I ever wrote. I do recall that FGETS has some fiddly requirements the docs don't explain very well.
I initialize my buffer Buff[256] to be all zeros, and Offset = 0 and READ = 0, here is the line
Hmm... I looked at my old module, and I always did an STRCLEAR on the buffer, then set _chBuffer[1]="x" before calling FGETS. I vaguely recall a long, painful learning process that lead to that. And I think setting all the buffer to be 0s actually doesn't work, it needs to be some valie alphanumeric char:
WAIT FOR STRCLEAR (_chBuffer[])
_chBuffer[1] = "x"
CWRITE ($FCT_CALL, _FgetsState, _Mode, "krl_fgets", _nFileHandle, _chBuffer[], _nFGetsLength, _nCharsRead)
CWRITE ($FCT_CALL, _EOFState, _Mode, "krl_feof", _nFileHandle, _bEOF)
Long old thread here: Re: CWRITE