Condition error

This is a discussion on Condition error within the C Programming forums, part of the General Programming Boards category; Hi to all, I have founded a problem in my program; it is in this code: Code: i=0; charRecv = ...

  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,163
    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, 02:49 PM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 09:33 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 12:10 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21