summaryrefslogtreecommitdiffstats
path: root/PrinterGUI/PrinterGUI_SRC/main.cpp
blob: 2b97c95c49ea3fe99a3c2d2a25b3efe2474cb690 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <QApplication>
#include <fstream>
#include "mainwindow.h"

int main(int argc, char *argv[])
{
    // First check parameter count
    if (argc != 3)
        return 2;

    // Check if file exists
    std::fstream f;
    try
    {
        f.open(argv[2], std::ios::in);
    }
    catch (std::fstream::failure e)
    {
        return 3;
    }
    f.close();

    QApplication a(argc, argv);
    MainWindow w(argv);
    w.show();

    return a.exec();
}