marble
Go to the documentation of this file.
12 #include <QCoreApplication>
13 #include <QDataStream>
16 #include <QStringList>
18 int main(
int argc,
char *argv[])
22 qDebug(
" Syntax: pntdel [-i pnt-sourcefile -o pnt-targetfile -id idNumber] " );
24 QString inputFilename(
"PDIFFBORDERS.PNT");
25 int inputIndex = app.arguments().indexOf(
"-i");
26 if (inputIndex > 0 && inputIndex + 1 < argc )
27 inputFilename = app.arguments().at( inputIndex + 1 );
29 QString outputFilename(
"NEW.PNT");
30 int outputIndex = app.arguments().indexOf(
"-o");
31 if (outputIndex > 0 && outputIndex + 1 < argc )
32 outputFilename = app.arguments().at( outputIndex + 1 );
35 int idIndex = app.arguments().indexOf(
"-id");
36 if (idIndex > 0 && idIndex + 1 < argc )
37 delIndex = app.arguments().at( idIndex + 1 ).toInt();
40 qDebug() <<
"input filename:" << inputFilename;
41 qDebug() <<
"output filename:" << outputFilename;
42 qDebug() <<
"remove index:" << delIndex;
45 QFile file( inputFilename );
47 if ( file.open( QIODevice::ReadOnly ) ) {
48 QDataStream stream( &file );
49 stream.setByteOrder( QDataStream::LittleEndian );
52 QFile data(outputFilename);
54 if (data.open(QFile::WriteOnly | QFile::Truncate)) {
55 QDataStream out(&data);
56 out.setByteOrder( QDataStream::LittleEndian );
64 while( !stream.atEnd() ){
65 stream >> header >> iLat >> iLon;
66 if ( header == delIndex ) {
69 else if ( header > 5 )
73 out << header << iLat << iLon;
78 qDebug() <<
"ERROR: Couldn't write output file to disc!";
83 qDebug() <<
"ERROR: Source file not found!";
int main(int argc, char *argv[])
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:52 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.