When reading the ANSI file in a UNICODE build you first need to read the data into a char buffer and then convert the text into a UNICODE string for further processing.
Please note that your code does not handle the possible presence of a BOM (Byte Order Mark) in the file. This article
] on reading and writing UNICODE files might be useful.
Do not use
for writing to UNICODE file
] it has problems.