starcorn
starcorn

Reputation: 8531

reading a binary file

Is it necessary to use reinterpret_cast< char*> when reading from a binary file. Since I found that a explicit typecast worked as well e.g. (char*), sizeof(int).

Upvotes: 0

Views: 404

Answers (1)

Elemental
Elemental

Reputation: 7466

both reinterpret_cast and the C-style explicit cast do exactly the same thing in your context. I prefer reinterpret_cast as it makes the nastiness more explicit when reading the code.

Upvotes: 1

Related Questions