Chinaunix首页 | 论坛 | 博客
  • 博客访问: 215855
  • 博文数量: 145
  • 博客积分: 3000
  • 博客等级: 中校
  • 技术积分: 1720
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-14 18:42
文章分类

全部博文(145)

文章存档

2011年(1)

2009年(144)

我的朋友

分类: LINUX

2009-07-27 11:46:29

by tangke 2009-07-27
今天写一个kpowersave上面的读proc里面的文件,竟然不知道Qt3怎么写了,所以把这段代码贴出来比较好,以后就怕又忘了。
qt3:
QFile file( "/proc/sys/kernel/osrelease" );
if ( file.open( IO_ReadOnly ) )
{
    QTextStream stream( &file );
    QString line = stream.readLine();
    line = tr("Kernel Version") + "\t" + line;
    new QLabel(line, p);
    file.close();
}

qt4:
QFile file( "/proc/sys/kernel/osrelease" );
if ( file.open( QIODevice::ReadOnly ) )
{
    Q3TextStream stream( &file );
    QString line = stream.readLine();
    line = tr("Kernel Version") + "\t" + line;
    new QLabel(line, p);
    file.close();
}
~                                                                                                                           
~                                                                                                                           
~                                       
阅读(571) | 评论(0) | 转发(0) |
0

上一篇:[quilt]: 2

下一篇:rpm deb alien

给主人留下些什么吧!~~