I am starting with OMNeT++ and C++ by going through the TicToc tutorial.
I would now like to make a modification on the behavior of one of the submodules Tic or Toc, specifically in handleMessage().
Currently, messages are handled by forwarding the received message to the other submodule without any manipulation of the message. Now, I would like to change this so that Tic checks the incoming message's string and if the value is "String 1" then if will generate a new message with string value "String 2" and send it to Toc.
However when I do this I get and error "comparison between distinct pointer types 'cMessage' and 'const char*' lacks a cast.
This is the code:
void Tic::handleMessage(cMessage *msg)
{
if (msg == "String 1")
{
cMessage *msg2 = new cMessage ("String 2");
send(msg2,"out");
}
}
Any help is appreciated. Thanks.