summaryrefslogtreecommitdiffstats
path: root/PrinterGUI/PrinterGUI_SRC/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'PrinterGUI/PrinterGUI_SRC/main.cpp')
-rw-r--r--PrinterGUI/PrinterGUI_SRC/main.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/PrinterGUI/PrinterGUI_SRC/main.cpp b/PrinterGUI/PrinterGUI_SRC/main.cpp
new file mode 100644
index 0000000..784c88a
--- /dev/null
+++ b/PrinterGUI/PrinterGUI_SRC/main.cpp
@@ -0,0 +1,28 @@
+#include <QApplication>
+#include <fstream>
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+ // First check parameter count
+ if (argc != 2)
+ return 2;
+
+ // Check if file exists
+ std::fstream f;
+ try
+ {
+ f.open(argv[1], std::ios::in);
+ }
+ catch (std::fstream::failure e)
+ {
+ return 3;
+ }
+ f.close();
+
+ QApplication a(argc, argv);
+ MainWindow w(argv[1]);
+ w.show();
+
+ return a.exec();
+}