primitive to fill a buffer