使用QT写入文件。将数据写入已写入文件的特定点 [英] Writing to file using QT. Write data to already written file at particular points

查看:695
本文介绍了使用QT写入文件。将数据写入已写入文件的特定点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在qt中按下按钮时生成的html文件。当我点击senddata按钮时,我想在html文件的特定点发送一些数据。我怎样才能提出具体的观点?

当我按下提交时,会生成A.html。
我必须在不同的时间插入data1,data2和data3。
这些数据应该插入到A.html文件中的某些特定点。



例如。在点击提交时,会生成A.html,下面是A.html中的数据。
line1


line2 < >



line3





在点击sendData时,文件应该看起来像是
A.html
b $ b line1
data3

line2 <
data1

line3

data2



请帮助。

Thanks!

解决方案

HTML文件就像一个XML文件。您可以使用QtXml模块在特定时间戳处插入子节点。



您应该开始阅读 http://qt-project.org/doc/qt-4.8/xml-dom-tml.html 并查看示例 http://qt-project.org/doc/qt-4.8/ examples-xml.html



一旦你掌握了这个概念,你可以提出一个关于SO的更具体的问题。祝你好运。


I have an html file which is generated when I press a button in qt. I want to send some data at a specific point in the html file when I click senddata button. How can I put the specific point.
When I press submit, A.html is generated. I have to insert data1, data2 and data3 at different time instances. These data should be inserted at some specific points in A.html file.

Ex. On clicking Submit, A.html is generated, below is the data in A.html
line1

line2

line3



On clicking sendData, the file should look like
A.html
line1
data3
line2
data1
line3
data2


Please help.
Thanks!

解决方案

A HTML file is like a XML file. You can use the QtXml module to insert child nodes at a specific timestamp.

You should start reading http://qt-project.org/doc/qt-4.8/xml-dom-tml.html and look at the examples http://qt-project.org/doc/qt-4.8/examples-xml.html

Once you have grasp the concept, you can ask a more specific question on SO. Good luck.

这篇关于使用QT写入文件。将数据写入已写入文件的特定点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆