I'm writing a program that works with binary files, and it isn't reading the file properly:
1 2 3 4 5 6 7 8 9 10 11
typedefchar byte;
...
if (!(argc-1)) return ERROR_BAD_ARGUMENTS;
// open the file
ifstream file;
file.open(args[0], ios::binary);
// get commands
byte* cmds = new byte[65535];
file.read(cmds, 65535);
Try this instead. Find the size of the file and then allocate your buffer. The Cplusplus.com C++ reference has a good example of how to do it. In fact I always use it.
@ OP: Because this isn't exactly a "beginner" task yet you posted in the beginner forum I wanted to ask if you actually know what the code is doing here?