error: invalid conversion from "const char*" to "char"
<p>This is on linux btw...</p>

<p>I'm getting this error from my code</p>

<pre><code>m-server.cpp: In function âvoid* SocketHandler(void*)â:
m-server.cpp:187: error: invalid conversion from âcharâ to âconst void*â
m-server.cpp:187: error:   initializing argument 2 of âssize_t send(int, const void*, size_t, int)â
</code></pre>

<p>The part that's giving an error:</p>

<pre><code>char welcomemsg;

cout &lt;&lt; "Set the welcome message: ";
cin &gt;&gt; welcomemsg;

//send initial welcome data || msg &amp; src
send(*csock, welcomemsg, sizeof(welcomemsg), 0); //this is line 187
</code></pre>

<hr>

<p><strong>UPDATE</strong></p>

<p>I have changed my mind rather than cIN then msg, I'd just want to set it like the code below.</p>

<p>I'm getting this error from my code</p>

<pre><code>m-server.cpp: In function âvoid* SocketHandler(void*)â:
m-server.cpp:181: error: invalid conversion from âconst char*â to âcharâ
m-server.cpp:230: error: jump to label âFINISHâ
m-server.cpp:177: error:   from here
m-server.cpp:181: error:   crosses initialization of âchar welcomemsgâ
m-server.cpp:230: error: jump to label âFINISHâ
m-server.cpp:161: error:   from here
m-server.cpp:181: error:   crosses initialization of âchar welcomemsgâ
m-server.cpp:230: error: jump to label âFINISHâ
m-server.cpp:149: error:   from here
m-server.cpp:181: error:   crosses initialization of âchar welcomemsgâ
</code></pre>

<p>The part that's giving an error:</p>

<pre><code>char welcomemsg = "@hello_! bro?"; //can allow symbols? 

//send initial welcome data || msg &amp; src
send(*csock, (void *)&amp;welcomemsg, sizeof(welcomemsg), 0);
</code></pre>

<p>I'm new to c++ what is the problem here? how to fix? and whats the reason behind it?</p>

<hr>

<p><strong>UPDATE</strong></p>

<p>The server didnt have any errors after i changed it to this.</p>

<pre><code>char *welcomemsg = "hello";

//send initial welcome data || msg &amp; src
send(*csock, welcomemsg, sizeof(welcomemsg), 0);
</code></pre>

<p>But now the client crashes when its receiving the welcome message. Why?<br>
This is the code that I used with the server and the client was reading the welcome message fine.</p>

<pre><code>send(*csock, "Hello_Word", 10, 0); //was a working code
</code></pre>

<hr>

<p><strong>UPDATE</strong></p>

<p>I have checked and client crashes on recv()<br>
What difference does this code have to all the suggestions? Why was this code working well with no crashing client?</p>

<pre><code>send(*csock, "Temporarily Offline_Server will open sockets on Jan. 14, 2013", 61, 0); //was a working code
</code></pre>

<hr>

<p><strong>UPDATE</strong></p>

<p>My recv() code:</p>

<pre><code>response = "";
resp_leng= BUFFERSIZE;
while (resp_leng == BUFFERSIZE)
{
    resp_leng= recv(sock, (char*)&amp;buffer, BUFFERSIZE, 0);
    if (resp_leng&gt;0)
        response+= string(buffer).substr(0,resp_leng);
}
</code></pre>
