Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to realize the function of Inter-process Dialogue in qt

Shulou Source: shulou.com Published: 2022-06-01 03:51:11 10月04日 Update

This article mainly explains "qt how to achieve inter-process dialogue function", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "qt how to achieve inter-process dialogue function" bar!

Sample code

The code on the called side is exactly the same as in yesterday's article, and only the code on the calling side is described here.

# include

# include

# include

Int main (int argc, char * argv [])

{

QCoreApplication a (argc, argv)

QProcess server

Server.start ("G:\\ Qt\\ 21070809 ProcessComm\\ ServerProcess\\ bin\\ debug\\ ServerProcess.exe"

, QStringList (); if (! server.waitForStarted ())

Return-1; QTextStream cin (stdin)

QTextStream cout (stdout)

QByteArray input

QByteArray response

While (input! = "bye\ n")

{

Cin > > input

Input + = "\ n"

Server.write (input)

Server.waitForReadyRead ()

Response = server.readLine ()

Response.replace ("\ r\ n", "")

Cout

Tags: Processes codes characters functions dialogues messages strings content learning loops articles input different same that is ideas situations more knowledge points Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Xiaomi MariaDB Redmi MySQL