I'm reading some codes where sometimes casting integer reference value to const char * used with ostream is happened.
uint32_t val;// initialized by some value
void a(ostream& os) const{
os.write((const char*)&val, sizeof(val));
}
Is it same to use (char *)&val as to use (const char *)?? If not, what's the difference??
Aucun commentaire:
Enregistrer un commentaire