The "reader" array only contains a single char. Your for loop lets i reach as high as 247. This is going to be a problem....