Search:

Type: Posts; User: dancp

Search: Search took 0.01 seconds.

  1. Replies
    15
    Views
    39,728

    Probably there are some differences between...

    Probably there are some differences between Windows and UNIX ... in this second case, s_addr has the lower case.
  2. Replies
    15
    Views
    39,728

    I ran the code as above and the print is 1010f6...

    I ran the code as above and the print is 1010f6 and I don't know hot it represents (I think it's a memory address) ...
  3. Replies
    15
    Views
    39,728

    sockin.sin_addr (where sockin is a sockaddr_in)...

    sockin.sin_addr (where sockin is a sockaddr_in) IS an in_addr ... I really don't understand why it doens't work ...
  4. Replies
    15
    Views
    39,728

    I tried, but it doesn't work again. int...

    I tried, but it doesn't work again.


    int main(int argc, char **argv) {
    struct hostent *hp;
    char *addr = "www.google.com";
    hp = gethostbyname(addr);

    //just a little "debug"
    if...
  5. Replies
    15
    Views
    39,728

    Ops, I forgot to tell I'm programming in UNIX. ...

    Ops, I forgot to tell I'm programming in UNIX.

    But I think inet_ntoa() is present, anyway.
  6. Replies
    15
    Views
    39,728

    How to print an IP address?

    How can I print an IP address contained in a struct hostent obtained by a gethostbyname() call?

    I simply tried a

    printf("%s", hos->h_addr);
    (where hos is a pointer to a struct hostent...
  7. Replies
    10
    Views
    1,452

    Thank you for the replies! I thought it was a...

    Thank you for the replies!

    I thought it was a memory access problem caused by the pointer (in the first case).

    In the second case, I put the string into a chars vector. Isn't a literal, in this...
  8. Replies
    10
    Views
    1,452

    Strings: char* or char vectors ?

    When I write some lines as


    int main(int argc, char **argv) {
    char *string = "Bla0 Bla1 Bla2 Bla3";
    char *temp;
    temp = strtok(string, " ");
    }
    I've an invalid address error on the strtok...
Results 1 to 8 of 8