Thread: Condition error

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    26

    Condition error

    Hi to all,
    I have founded a problem in my program; it is in this code:
    Code:
           i=0;
           charRecv = recv(nSocketDesc, &c, 1, 0);
           while (c !='\n')
           {
            mystring[i++]=c;
            charRecv = recv(nSocketDesc, &c, 1, 0); 
           } // End while (c !='\n') 
           mystring[i]='\0';
    I need that while ends when the client press enter.
    But don't happen therefore.Sure, I mistake the condition in while.
    Please, someone can help me?
    Thank You and Best Regards.
    Nick

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    The while() loop looks fine to me. Maybe you should check the return value of recv() to see if it's throwing an error?
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  3. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM