use ifstream to read files instead of CoreFoundation NSData