I have a binary file (filename is in argv[1], size is always 64KiB) which I need to put the contents of into an unsigned char array using ifstream. I have tried to do so using the >> operator, but that only put garbage data into the array.
Here is the code:
unsigned char ROMInit[65536];
std::ifstream ROMFile(argv[1], std::ios::binary | std::ios::in);
for (unsigned int i = 0; i < 65536; i++) {
testFile >> ROMInit[i];
}
How can I put the contents of the file into the array?