Code:
int row, col, pos = 0;
for ( row = 0 ; row < 250 ; row++ ) {
  for ( col = 0 ; col < 320 ; col++ ) {
    // do stuff with buff[pos], plot pixel at row,col
    pos++;
  }
}