Hello,
i have a slight problem and i think im just missing something obvious here, so instead of pulling my hair out i decided to ask for help
this is my class declaration
#ifndef PARSER_H
#define PARSER_H
#include <QFile>
#include <QTextStream>
#include <QString>
#include <QTextStream>
#include <QMessageBox>
#include <QDebug>
{
Q_OBJECT
public:
explicit parser
(QObject *parent
= 0);
int read_line();
private:
};
#endif // PARSER_H
#ifndef PARSER_H
#define PARSER_H
#include <QFile>
#include <QTextStream>
#include <QString>
#include <QTextStream>
#include <QMessageBox>
#include <QDebug>
class parser : public QObject
{
Q_OBJECT
public:
explicit parser(QObject *parent = 0);
void proces_line(QString line);
int read_line();
private:
};
#endif // PARSER_H
To copy to clipboard, switch view to plain text mode
and the implemenation
#include "parser.h"
{
}
void parser
::proces_line(QString line
) {
qDebug()<<"im reading";
}
int parser::read_line()
{
QFile file("C:/Qt/test/downloaded.txt");
if(!file.exists())
{
qDebug()<<"the file does not exist";
return 1;
}
{
qDebug()<<"failed to open";
return 1;
}
while (!line.isNull())
{
process_line(line); ***
line = in_stream.readLine();
}
;
return 0;
}
#include "parser.h"
parser::parser(QObject *parent) :
QObject(parent)
{
}
void parser::proces_line(QString line)
{
qDebug()<<"im reading";
}
int parser::read_line()
{
QFile file("C:/Qt/test/downloaded.txt");
if(!file.exists())
{
qDebug()<<"the file does not exist";
return 1;
}
if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug()<<"failed to open";
return 1;
}
QTextStream in_stream(&file);
QString line=in_stream.readLine();
while (!line.isNull())
{
process_line(line); ***
line = in_stream.readLine();
}
;
return 0;
}
To copy to clipboard, switch view to plain text mode
*** this is where i get a C3861: 'process_line)':identifier not found
and main
#include "mainwindow.h"
#include "parser.h"
#include <QApplication>
int main(int argc, char *argv[])
{
MainWindow w;
w.show();
parser p;
p.read_line();
return a.exec();
}
#include "mainwindow.h"
#include "parser.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
parser p;
p.read_line();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
im trying to build a class (just a skeleton code) to parse my txt file (need to grab some specific information from it)
so some tips would also be welcome if you spot something.
thx in advance
Bookmarks