This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: error using "struct"


Hi Fernanda,

>cli.sin_addr.s_addr=htonl(192.168.200.241);

The 192.168.200.241 is not a valid number in C/C++. For that, you'd need something like:
htonl((192L << 24) + (168L << 16) + (200L << 8) + 241);


But, shouldn't you do something similar to...

cli.sin_addr.s_addr=inet_addr("192.168.200.241");

...like you did earlier?

--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]