adding write() functions accept int, vecval