Results 1 to 3 of 3

Thread: Help with C

  1. #1
    Join Date
    May 2012
    Beans
    1

    Help with C

    Hi everybody i'm trying to make that work:
    ssize_t len;
    printf("message à envoyer: \n");
    fflush(stdout);

    if (fgets(buff, BUF_SIZE, stdin) == NULL) {
    fprintf(stderr, "Echec de lecture des données reçus\n");
    exit(EXIT_FAILURE);
    }

    len = write(s, buff, strlen(buff));

    if(strcmp(buff,"quitter")==0)
    exit(0);

    there is a problem in
    if(strcmp(buff,"quitter")==0)
    exit(0);
    it's not working

  2. #2
    Join Date
    Oct 2011
    Location
    Chicago, IL
    Beans
    419
    Distro
    Xubuntu 10.04 Lucid Lynx

    Re: Help with C

    what error messages are you getting? at compile-time or runtime?

    also, I'm assuming this is a chunk of your main(), right? Please post the entire function. Of particular interest to me is where "buff" is declared.

  3. #3
    Join Date
    Nov 2005
    Location
    Sendai, Japan
    Beans
    11,296
    Distro
    Kubuntu

    Re: Help with C

    Quote Originally Posted by faresallayl View Post
    there is a problem in
    if(strcmp(buff,"quitter")==0)
    exit(0);
    it's not working
    The newline.
    「明後日の夕方には帰ってるからね。」


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •