0

I am working on a very simple and quick program in qt to convert an entire file to a single line string and prints it out. It is run through the command line. I have one problem. When compiling the program Qt Creator gives me this error conversion from 'char**' to 'QChar' is ambiguous main.cpp 12

Here's my code:

#include <QApplication>
#include <QStringList>
#include <QFile>
#include <QTextStream>
#include <QStringList>
#include <QDebug>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QString b (argv);
    QFile sFile(b);
    QTextStream in(&sFile);
    QString text = in.readAll();
    sFile.close();

    QStringList doc;
    doc<< text;
    QString f = doc.join(" ");
    QString final = f;
    qDebug()<<final;

    return a.exec();
}
crank123
  • 251
  • 1
  • 4
  • 17

1 Answers1

2

argv is a vector of char* (c strings). choose the string you are interested in:

QString b(argv[1]);

avim
  • 979
  • 10
  • 25