I have the following piece of code:
*************
puerto = getenv("PUERTO");
my_addr.sin_port = (short int)*puerto;
***************
where getenv is a function that returns a pointer to a char, and my_addr.sin_port is an unsinged short int.
As you can see, the issue here is the conversion from
char* to unsigned short int.
I get no compiler error with the above code, but I'm not sure it'll work in run-time.
Even if I remove the cast conversion (short int), I get no compiler error, which seems suspicious.
What is the best way to perform this conversion?
Thanks a lot.
-- naradaji
