Why don't you copy exactly what you are doing in setup() when you read the file? It will work just fine in loop() as well.