Hi i am trying to read a file , say for example 'sample.txt', in binary mode-c++ and i need to store the file text (eg."nodeA nodeB") in a vector . eg: "A A B E A B G" if this is what is in the text file , i want to read it in binary form and then store it in some variable and then do some operations to it . Any help would be appreciated. So far i have got is :
int main () {
streampos begin,end;
ifstream myfile ("example.bin", ios::binary);
begin = myfile.tellg();
myfile.seekg (0, ios::end);
end = myfile.tellg();
myfile.close();
cout << "size is: " << (end-begin) << " bytes.\n";
return 0;
}
The text part in the file myfile can be got how ?