get input from index using buffer