<aa******@gmail.comwrote in message...
Hi,
I have a text file "test.txt" that contains a series of 0's and 1's.
For example,
0000001000010100011000
I need to read these values into an array so that i can perform a
comparison with another array, and I don't know how to read the
information from the text file into an array of integers or bits.
Any help I can get is greatly appreciated.
Thanks!
{
std::string line;
std::getline( MyInFile, line );
std::vector<chararray;
for( size_t i(0); i < line.size(); ++i ){
array.push_back( line.at( i ) );
}
}
Of course, if your file is bigger than std::string.max_size(), you'll need
to do it differently. (..and there are faster ways than I have shown.)
On my win system:
std::string Astr;
cout<<"Astr.max_size() ="<<Astr.max_size()<<std::endl;
// output: Astr.max_size() =1073741820
--
Bob R
POVrookie