Im trying to read a single byte from a binary file and convert it into a bitset, and print it to the console however the following code raises an error.
ifstream test(filePath, ios::in | ios::binary);
char * byte = new char;
test.read(byte, 1);
cout << std::bitset<8>(byte);
Unhandled exception at 0x757DA842 in program.exe: Microsoft C++ exception: std::invalid_argument at memory location 0x006FEBE4.
I cant seem to figure out what is wrong and have tried a variety of things, any idea how to fix this?
Thanks