I am trying to copy the contents of the binary file whose path I have specified in the code to a vector using the methods in the link, but I am getting the error in the line I added as a comment line. how can i solve this error or which method is best for me?
Link: https://sites.google.com/site/hashemian/home/tips-and-tricks/copy-array-cpp
void MainWindow::on_horizontalScrollBar_actionTriggered(int action)
{
QFile read_data("C:/Users/cats_user/Desktop/00000000.log");
char file_data;
QByteArray fullContent;
if(!read_data.open(QFile::ReadOnly)){
return;
}
while(!read_data.atEnd()){
read_data.read(& file_data, sizeof(char));
fullContent.append((file_data));
}
std::vector<char>theVector;
int n =sizeof (fullContent)/sizeof (char);
theVector.insert(theVector.end(), fullContent, fullContent+n); // 'operator int' is a private member of QByteArray note: declared private here
}