如何在没有对话框的情况下用c ++(qt 4)编写文件 [英] How to write a file in c++ (qt 4) without a dialog

查看:113
本文介绍了如何在没有对话框的情况下用c ++(qt 4)编写文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何用qt写一个文件?

标题是(lineedit text + .txt)?

和位置是固定的(〜/ .myproject)

我是qt和c ++的新手,我来自vb.net,因为vb.net不能使用Linux然后我正在学习qt。

How to write a file in qt ?
The title is going to be (lineedit text + .txt)?
and the location is fix to (~/.myproject)
I am new to qt and c++ and i am coming from vb.net since vb.net doen''t work with Linux then i am learning qt.

推荐答案

写一个文件已经完全不相关到任何对话框,一般与UI无关。如果你有一个与.NET相关的印象,这只是因为你对.NET没有任何线索,无论你创建了多少代码。



理想情况下,编写文件不应与QT相关。然而,由于某些原因(我不认为这是讨论它们的地方),文件支持包含在QT中。请参阅:

http://doc.qt.digia.com/qt/qfile .html [ ^ ],

http://doc.qt.digia.com/qt/qiodevice.html [ ^ ],

http://doc.qt.digia.com/qt/qbuffer.html [< a href =http://doc.qt.digia.com/qt/qbuffer.html\"target =_ blanktitle =New Window> ^ ]。



使用C ++,您可以通过< cstdio> < iostream> ,但另请参阅上面QT参考页面参考中的评论,第一个。



-SA
Writing a file is already totally unrelated to any dialog, and unrelated to UI in general. If you had the impression that is it related in .NET, this is only because you have no clue about .NET as well, no matter how much of code you created.

Ideally, writing files should not be related to QT. Nevertheless, by some reasons (I don''t think this is a place to discuss them), file support is included in QT. Please see:
http://doc.qt.digia.com/qt/qfile.html[^],
http://doc.qt.digia.com/qt/qiodevice.html[^],
http://doc.qt.digia.com/qt/qbuffer.html[^].

With C++, you can directly use C++ API via <cstdio> or <iostream>, but see also the comments in the QT reference page reference above, the first one.

—SA


这篇关于如何在没有对话框的情况下用c ++(qt 4)编写文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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