I need to read the whole content of a binary file and pass it to my method that receives as input a char array. I have a doubt about casting:
infile.open(argv[1], std::ios::binary);
infile.seekg(0, std::ios::end);
size_t file_size_in_byte = infile.tellg();
std::vector<char> data;
data.resize(file_size_in_byte);
infile.seekg(0, std::ios::beg);
infile.read(&data[0], file_size_in_byte);
How can I cast the vector to a char array now without having security memory errors?