【问题标题】:Append new data at endof file qsetting在文件 qsetting 的末尾追加新数据
【发布时间】:2017-03-09 06:03:16
【问题描述】:

我可以使用 qt Qsetting 编写配置文件。但我希望它应该写在文件的底部。

QSettings* settings= new QSettings("/home/sidheshwar/Desktop/temp.txt", QSettings::IniFormat);
 settings->setValue("Profiles/"+aaaa,one );

这怎么可能。

【问题讨论】:

    标签: qt qt-creator qsettings


    【解决方案1】:

    QSettings 提供键/值存储(分段),它没有明确的排序概念;你不能告诉它在其他东西之前或之后放置一些东西,它会以它认为合适的任何顺序编写设置。将其视为QHashstd::map - 它有效地将键映射到值,但不允许您设置任意元素顺序。

    如果您需要这种功能,您必须实现自己的 INI 文件读/写类。

    【讨论】:

    • 关于主题,我刚刚看到你的用户资料Every morning int, double and size_t wake up and go to buy the newspaper. They read the news together, then int and double check their horoscope; size_t never bothers. Why?的答案是什么
    • 因为它没有星座,所以它没有任何星座可以检查,可怜的东西:o)(size_t是一个无符号类型)
    猜你喜欢
    • 1970-01-01
    • 2013-03-21
    • 1970-01-01
    • 1970-01-01
    • 2023-03-02
    • 2013-10-26
    • 2019-05-30
    • 2011-08-19
    • 1970-01-01
    相关资源
    最近更新 更多