summaryrefslogtreecommitdiffstats
path: root/kdecore/tests/kprociotest.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kdecore/tests/kprociotest.cpp
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdecore/tests/kprociotest.cpp')
-rw-r--r--kdecore/tests/kprociotest.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/kdecore/tests/kprociotest.cpp b/kdecore/tests/kprociotest.cpp
new file mode 100644
index 000000000..7585b7657
--- /dev/null
+++ b/kdecore/tests/kprociotest.cpp
@@ -0,0 +1,65 @@
+//
+// MAIN -- a little demo of the capabilities of the "KProcess" class
+//
+// version 0.2, Aug 2nd 1997
+// $Id$
+//
+// (C) Christian Czezatke
+// e9025461@student.tuwien.ac.at
+//
+
+
+#include "kprocess.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <kapplication.h>
+
+#include <signal.h>
+
+#include "kprociotest.h"
+
+
+
+//
+// A nice input for "sort"... ;- )
+//
+static const char txt[] = "hat\nder\nalte\nhexenmeister\nsich\ndoch\neinmal\nwegbegeben\n\
+und\nnun\nsollen\nseine\ngeister\nsich\nnach\nmeinem\nwillen\nregen\nseine\nwort\nund\n\
+werke\nmerkt\nich\nund\nden\nbrauch\nund\nmit\ngeistesstaerke\ntu\nich\nwunder\nauch\n";
+
+
+int main(int argc, char *argv[])
+{
+ Dummy dummy;
+ KApplication app(argc, argv, "kprociotest");
+
+ printf("Welcome to the KProcIO Demo Application!\n");
+
+
+ KProcIO p;
+
+ p << "rev";
+
+ p.connect(&p, SIGNAL(processExited(KProcess*)), &dummy, SLOT(printMessage(KProcess*)));
+ p.connect(&p, SIGNAL(readReady(KProcIO*)), &dummy, SLOT(gotOutput(KProcIO*)));
+
+ bool b;
+
+ b = p.start();
+ printf("Start returns %s\n", b ? "true" : "false");
+
+ b = p.fputs("Hello World!");
+ printf("fputs returns %s\n", b ? "true" : "false");
+
+ b = p.fputs("This is a test. It should come out in reverse (esrever)");
+ printf("fputs returns %s\n", b ? "true" : "false");
+
+ p.closeWhenDone();
+
+ printf("Entering man Qt event loop -- press <CTRL><C> to abort\n");
+ app.exec();
+
+ return 0;
+}
+#include "kprociotest.moc"