当前位置: 代码迷 >> QT开发 >> qt资源文件使用txt有关问题
  详细解决方案

qt资源文件使用txt有关问题

热度:83   发布时间:2016-04-25 04:40:37.0
qt资源文件使用txt问题
我在资源文件中添加了三个txt文件

资源文件:
XML code
<RCC>    <qresource prefix="/data">        <file alias="Board1.jpg">data/image/Board.jpg</file>        <file alias="Board2.jpg">data/image/Board2.jpg</file>        <file>ani_1.txt</file>        <file>ani_2.txt</file>        <file>ani_3.txt</file>    </qresource></RCC>


但是在代码中如下:
C/C++ code
    ifstream input;    char p;    if(frame == 1)        input.open(":/data/ani_1.txt");    else if(frame == 2)        input.open(":/data/ani_2.txt");    else if(frame == 3)        input.open(":/data/ani_3.txt");    if(input.fail())    {        qWarning("open file failed");        return;    }


显示open file failed,求教……

------解决方案--------------------
话说 qrc会将资源文件编译到可执行程序里面的,对于这种大小可变的文件,qt的资源系统支持吗
  相关解决方案