I need to send a variable of type mode_t through a socket. How do i do it? I mean I could convert it to a string using snprintf()..but is it ok?
Thanks
To transmit mode_t
safely you must convert it to some alternate form. There is no reason to believe the two hosts communicating will use the same flag definitions for mode_t
, so printing it as an integer is not even sufficient; you need to iterate over all the mode flags and check each one.