Error Trying to take out a qlist from a binary file
Code:
{
out>>w;
out>>x;
out>>y;
out>>z;
out>>list->register; //<--- the line who dont run according to the debugger but i dont know why, this is my qlist
list->plate=w;
list->brand=x;
list->mileage=y.toDouble();
list->cylinder_capacity=z.toDouble();
return out;
}
Re: Error Trying to take out a qlist from a binary file
You have to provide the definition of the datatype car, then only we will get to know about the main problem.
Re: Error Trying to take out a qlist from a binary file
I already do that but I don't why is keeping doing the same error when i tried to read te binary file
Re: Error Trying to take out a qlist from a binary file
Why are you using a reference to a pointer as second argument to operator >> ? This is how such method looks like most of the time:
What kind of error do you get ? Is your pointer null ?
Re: Error Trying to take out a qlist from a binary file
It doesn't even run, when my program starts is looking for the file and found it but when i tries do put the qlist inside my instance of qlist don't work
here is the code where I read
Code:
QFile read
("register.txt");
if(read.exists()){
in >> cars;
read.close();
}
}
cars is my list in the main (QList<car> cars)
Re: Error Trying to take out a qlist from a binary file
Quote:
this is my qlist: car *&list
This is not a QList<car>. It isn't even a QList< car * >. It is a reference to a pointer to a "car" instance. So calling "in >> cars" can't possibly call this method if "cars" is actually a QList<car>, because the QDataStream operator you have defined doesn't match the required function signature.
So what does your code really look like? What you have posted isn't complete enough.