Saturday, February 5, 2011

IRC Client Sending Messages Improperly, C++

Programmer Question

The problem occurs when sending messages. They segment into individual messages where spaces are. The messages are composed using sprintf(message, "PRIVMSG %s :%s\n", irc_chan, buffer); The error will appear as follows(Individual messages are contained in ""s). I will enter a message "Hi there". It will output "Hi" "there". buffer is a char[1024]. Any ideas please let me know.



The following is the part of the code that sends the message, the class I've used for the socket is of no concern to you, I can receive messages and connect FINE.



scanf("%s", buffer);
sprintf(message, "PRIVMSG %s :%s", irc_chan, buffer);
send(IRCSocket.iSocket, message, strlen(message), 0);


Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails