title: C++ Sockets - Sending messages with new line (linux)
body: <p>I am trying to send messages from client to server and vice versa. The messages are receiving correctly but I have to put an <code>*</code> at the end of every message.</p>
  
  <p>The control loop I am using is <code>*buffer != '*'</code>. I tried to replace with <code>\n</code> or checking with via ASCII value which is 10 through <code>static_cast</code> but the message is not going.</p>
  
  <p>How do I transfer messages when the user enters a new line (\n). I am thinking of <code>cin.getline</code>. is it okay to use it with a pointer?</p>
  
  <p>server.cpp</p>
  
  <pre><code>     do {
              recv(server, buffer, bufsize, 0);
              cout &lt;&lt; buffer &lt;&lt; " ";
              if (*buffer == '#') {
                  *buffer = '*';
                  isExit = true;
              }
          } while (*buffer != '*');
  
          do {
              cout &lt;&lt; "\nServer: ";
              do {
                  cin &gt;&gt; buffer;
                  send(server, buffer, bufsize, 0);
                  if (*buffer == '#') {
                      send(server, buffer, bufsize, 0);
                      *buffer = '*';
                      isExit = true;
                  }
              } while (*buffer != '*');
  
              cout &lt;&lt; "Client: ";
              do {
                  recv(server, buffer, bufsize, 0);
                  cout &lt;&lt; buffer &lt;&lt; " ";
                  if (*buffer == '#') {
                      *buffer == '*';
                      isExit = true;
                  }
              } while (*buffer != '*');
          } while (!isExit);
  </code></pre>
  
  <p>client.cpp </p>
  
  <pre><code>     do {
          cout &lt;&lt; "Client: ";
          do {
              cin &gt;&gt; buffer;
              send(client, buffer, bufsize, 0);
              if (*buffer == '#') {
                  send(client, buffer, bufsize, 0);
                  *buffer = '*';
                  isExit = true;
              }
          } while (*buffer != 42);
  
          cout &lt;&lt; "Server: ";
          do {
              recv(client, buffer, bufsize, 0);
              cout &lt;&lt; buffer &lt;&lt; " ";
              if (*buffer == '#') {
                  *buffer = '*';
                  isExit = true;
              }
  
          } while (*buffer != 42);
  </code></pre>
  
  <p>Thanks!</p>