can someone explain this line for me ? :0

explain the line underlined plz ?:0

1
2
3
std::ifstream fin;
fin.open("itemstore.dat",ios::binary);
fin.read((char*)&amt,sizeof(amt));
Did you check the reference page?
http://www.cplusplus.com/reference/istream/istream/read/

You don't show the declaration of amt, so it's not clear whether that is an int, a double, a struct, or something else.

In any case, the statement takes the address of amt (whatever that is), casts it to a char pointer which is what read is expecting, passes the byte size of amt as the second argument, then calls read on the fin ifstream.
Topic archived. No new replies allowed.