Move readsize value assignment out of while statement.