How NOT to skip BOM info (FF FE) when using fread or ifstream?
Posted
by al_lea
on Stack Overflow
See other posts from Stack Overflow
or by al_lea
Published on 2010-03-19T05:34:21Z
Indexed on
2010/03/19
5:41 UTC
Read the original article
Hit count: 169
I'm trying to use fread/ifstream to read the first 2 bytes of a .csv with BOM info. But following code always skips the first two bytes (which are 'FF FE'):
ifstream is;
is.open (fn, ios::binary );
char buf[2];
is.read(buf, 2);
is.close();
using FILE*/fread does no better.
© Stack Overflow or respective owner