Thursday, 15 January 2015

c++ - Read a list of signed shorts from a binary file using the >> operator -



c++ - Read a list of signed shorts from a binary file using the >> operator -

isn't possible through >> operator ?

sources :

http://en.cppreference.com/w/cpp/io/basic_istream/operator_gtgt http://www.cplusplus.com/reference/istream/istream/operator%3e%3e/

the value of 's' remains same : doesn't seem grab number input stream.

vector<signed short> creadfiletest::readintegersfromfile( const char * filename ) { ifstream ifs(filename, ifstream::in, ifstream::binary); vector<signed short> vec ; if (ifs) { signed short s ; while (!ifs.eof()) { ifs >> s; vec.push_back(s); } ifs.close(); } homecoming vec; }

when open binary file have utilize read.

c++ stream short

No comments:

Post a Comment