Re: [OT, redirect] Re: gethostbyname(string here)



Kenneth Brody wrote:
Artie Gold wrote:

ruroma@xxxxxxxxx wrote:

Hello,

   I have one problem, and can think of two possible solutions but I
can't manage to make them work.  I'm open to other suggestions if you
thik is better.

[Brief Situation]  The main function calls sendSocket, but I don't know
how to tell it where to send the socket. ( I think I'm messing it up
with pointers)

[...]

As such things are handled in a platform specific way (they are not part
of standard C) please ask in a forum specific to your platform.

[And, of course, you *should* have read the FAQ before posting.]


While the example is using gethostbyname(), the real question being
asked is "how can I get a string from the user, and pass it to a
function", which would certainly not be off-topic.  The fact that
the function is gethostbyname() and not print_foo(), is irrelevant
in this instance.

His followup post showed he found the correct answer -- that fgets()
leaves the newline intact, and he had to remove it before passing the
string to the function.


Point taken.

However, even in a case like that, it behooves the OP to provide a visible prototype for any non-standard function (yes I know what gethostbyname() does -- but not when I'm wearing this hat ;-)).

Cheers,
--ag

--
Artie Gold -- Austin, Texas
http://goldsays.blogspot.com (new post 8/5)
http://www.cafepress.com/goldsays
"If you have nothing to hide, you're not trying!"
.



Relevant Pages

  • Re: gethostbyname problem
    ... For some reasons, gethostbyname() doesn't function ... WSADATA wsaData; ... What exactly is in this chHost string and what does it contain? ... But when try to use the same thing for the second time gethostbyname ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: [OT, redirect] Re: gethostbyname(string here)
    ... Artie Gold wrote: ... > of standard C) please ask in a forum specific to your platform. ... While the example is using gethostbyname(), ... string to the function. ...
    (comp.lang.c)
  • Re: gethostbyname problem
    ... For some reasons, gethostbyname() doesn't function ... WSADATA wsaData; ... What exactly is in this chHost string and what does it contain? ... But when try to use the same thing for the second time gethostbyname ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: gethostbyname problem
    ... What exactly is in this chHost string and what does it contain? ... gethostbyname() doesn't parse strings in dotted quad notation, ... resolves hostnames. ... returns error WSANOTINITIALISED (Though WSAStartUp function is executed ...
    (microsoft.public.windowsce.embedded.vc)