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) |