'\n' in QTcpSocket.write()
-
There are many ways to do it. You have read the QIODevice class docs, right? and you understand that const char* or QByteArray& can be passed to Write()?
After that it's just basic C/C++ programming.
But the more important question is what EXACTLY do you really want to send, <CR>? <LF>? <CR><LF>?
Streams based RFC protocols will specify exactly what they expect as an end-of-line sequence. Many text based protocols expect <CR><LF>.
-
Hello, I want to ask if there is a way to send string with '\n'? ( I don't want R"(string)", but if this is an only option then I will use it )
@NintyS
There is no problem sending a newline (or any other character) viaQTcpSocket.write(). If you do not want to writeR"(string\n)"in your code you can always do it without theRliteral string syntax via"string\\n". Or similarly as @Kent-Dorfman says if you need to send"string\\r\\n".