I am working with the communication for some TCP/IP connected equipment in C++. The equipment requires that the commands sent are ended with \r\n.
I am using a configuration file from which I am reading the commands used in the communication.
The problem I have is that the commands \r\n are interpreted as the 4 characters they are and not as carriage return and line feed.
I have tried to use the string.data() but I get the same result as string.c_str().
Is there any nice function to get it correct from the beginning or do I have to solve this with a normal replace function? Or some other way that I have not thought about?
I guess, if I don't find a really neat way to do this I will just omitt the \r\n in the configuration file and add it afterwards, but it would be nice to have it all in the configuration file without any hard coding. I think I would need to do some hard coding as well if I would try to replace the four characters \r\n with their correct characters.
Thanks for any help
Edit: The config file contains lines like this one.
MONITOR_REQUEST = "TVT?\r\n"