You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the SetCharsAt function does not work. I tried converting from string to a byte slice, writing to plc, and reading back using GetCharsAt. The values return all zeros.
ive found the solution below to work
//SetCharsAt Set Array of char (S7 ARRAY OF CHARS)
func (s7 *Helper) SetCharsAt(buffer []byte, pos int, value string) {
copy(buffer[pos:pos+len(value)], []byte(value))
//buffer = append(buffer[:pos], append([]byte(value), buffer[pos:]...)...)
}
The text was updated successfully, but these errors were encountered:
the SetCharsAt function does not work. I tried converting from string to a byte slice, writing to plc, and reading back using GetCharsAt. The values return all zeros.
ive found the solution below to work
//SetCharsAt Set Array of char (S7 ARRAY OF CHARS)
func (s7 *Helper) SetCharsAt(buffer []byte, pos int, value string) {
copy(buffer[pos:pos+len(value)], []byte(value))
//buffer = append(buffer[:pos], append([]byte(value), buffer[pos:]...)...)
}
The text was updated successfully, but these errors were encountered: