Open file in read-only mode, convert line by line

Signed-off-by: Trần Ngọc Quân <vnwildman@gmail.com>