Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!sri-unix!sri-spam!mordor!lll-lcc!unisoft!hoptoad!academ!killer!toma From: toma@killer.UUCP (Tom Armistead) Newsgroups: comp.lang.c Subject: Re: 'incompatble types error'- help needed Message-ID: <1076@killer.UUCP> Date: Tue, 30-Jun-87 22:13:13 EDT Article-I.D.: killer.1076 Posted: Tue Jun 30 22:13:13 1987 Date-Received: Sat, 4-Jul-87 19:47:14 EDT References: <1524@batcomputer.tn.cornell.edu> Organization: The Org. for the Disorg. of Org. Lines: 25 Summary: Use the Type Cast operator In article <1524@batcomputer.tn.cornell.edu>, hurf@batcomputer.tn.cornell.edu (Hurf Sheldon) writes: > /* text removed . . . */ > > the problem (from tn3270's telnet.c) > sin.sin_addr.s_addr = inet_addr(argv[1]) > causes the error " operands of = have incompatible types" > where argv is declared char *argv[], 'sin.sin_addr.s_addr' is > u_long (from include/netinet/in.h ) and inet_addr() is declared > 'external unsigned long inet_addr();' in telnet.c > > Is there a way to get this past the compiler - I have tried a couple of > (probably simplistic) redefines and they have made thing worse. I don't what the type 'u_long' is, but if is a true type, like 'char' or 'int', ect..., then a type cast oper. should do it for you, like this: sin.sin_addr.s_addr = (u_long)inet_addr(argv[1]); ^^^^^^^^ |__this is the 'Type Cast' Tom UUCP: ihnp4\ \killer!toma infoswx!convex!dj3b1/ Tom Armistead