|
-
December 19th, 2002, 04:19 AM
#1
conversion help
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|