#include <qfile.h>
#include <qstringlist.h>
#include <qtextstream.h>
#include <qstring.h>
QStringList lines;
QFile file( "file.txt" );
if ( file.open( IO_ReadOnly ) ) {
QTextStream stream( &file );
QString line;
int i = 1;
while ( !stream.atEnd() ) {
line = stream.readLine(); // line of text excluding '\n'
printf( "%3d: %s\n", i++, line.latin1() );
lines += line;
}
file.close();
}
#include <qstringlist.h>
#include <qtextstream.h>
#include <qstring.h>
QStringList lines;
QFile file( "file.txt" );
if ( file.open( IO_ReadOnly ) ) {
QTextStream stream( &file );
QString line;
int i = 1;
while ( !stream.atEnd() ) {
line = stream.readLine(); // line of text excluding '\n'
printf( "%3d: %s\n", i++, line.latin1() );
lines += line;
}
file.close();
}
'Linux' 카테고리의 다른 글
stat (0) | 2013.09.26 |
---|---|
proc (procfs) (0) | 2013.09.26 |
파일에 수정 시간 가져오기 (0) | 2013.09.26 |
[tip] vim (0) | 2013.09.26 |
[source] my bashrc file (0) | 2013.09.26 |