[英]How to get structured data from a named pipe and write it into a qtableview in Qt
struct my_structure {
char name[15]; /*thread name*/
int pid; /* pid of the thread */
int ppid; /* parent pid of the thread */
};
struct my_structure m1[]={{"skier",12,14},{"skier1",13,14}};
I want to display the contents of these these structure instances in a table in Qt using QTableView
. 我想使用QTableView
在Qt的表中显示这些结构实例的内容。 so want to pass this structured data to my Qt program through a named pipe/fifo. 所以想通过命名管道/ fifo将此结构化数据传递到我的Qt程序。
Please guide me how to pass this structured data in my Qt program through named pipe/fifo and how to read the contents of the structure from the fifo so that i could display them in a QTableView
. 请指导我如何通过命名管道/ fifo在Qt程序中传递此结构化数据,以及如何从fifo读取结构的内容,以便可以在QTableView
显示它们。 also suggest me the code for displaying the contents of the structure in a table. 还建议我在表中显示结构内容的代码。
use fopen ("/path/to/named-pipe",....) & then fread / fwrite or 使用fopen (“ / path / to / named-pipe”,....)& fread / fwrite或
use open ("/path/to/named-pipe",....) & then read / write . 使用open (“ / path / to / named-pipe”,....)&然后读 / 写 。
You can read/write the fifos in same manner as simple files. 您可以用与简单文件相同的方式读取/写入fifo。
For non-blocking IO, refer : How do I perform a non-blocking fopen on a named pipe (mkfifo)? 对于非阻塞IO,请参阅: 如何在命名管道(mkfifo)上执行非阻塞fopen?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.