0
C++ vector to binary file
Hello I have a task to put random vector in a binary file and read this binary file to check if everything is ok. I dont know how to read binary file i made something like this and it isn't working. vector<float> binaryReading(){ string filename ="tekstBinary.txt"; ifstream input(filename, ios::binary); if (input) { int i; while (input.read(reinterpret_cast<char*> (i), sizeof(i))) cout << i << " "; } input.close(); }
2 Answers
0
you need to give the pointer to the "i" in the reinterpret cast parameter, that is "&i"
0
ok nvm i didnt see the date