diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-12-15 22:06:44 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-12-15 22:06:44 +0900 |
commit | af644c020106e7096d4fe9c648f25eede98c972f (patch) | |
tree | e20b7c4bc22bca994e80e6a798313b5800efce21 /tdecore/tests/tdeprociotest.cpp | |
parent | a876c10e905fa357d43de03cf0fcb922cac9e4d5 (diff) | |
download | tdelibs-master.tar.gz tdelibs-master.zip |
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'tdecore/tests/tdeprociotest.cpp')
-rw-r--r-- | tdecore/tests/tdeprociotest.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/tdecore/tests/tdeprociotest.cpp b/tdecore/tests/tdeprociotest.cpp new file mode 100644 index 000000000..16c9b14b6 --- /dev/null +++ b/tdecore/tests/tdeprociotest.cpp @@ -0,0 +1,65 @@ +// +// MAIN -- a little demo of the capabilities of the "TDEProcess" class +// +// version 0.2, Aug 2nd 1997 +// $Id$ +// +// (C) Christian Czezatke +// e9025461@student.tuwien.ac.at +// + + +#include "tdeprocess.h" + +#include <stdio.h> +#include <string.h> +#include <tdeapplication.h> + +#include <signal.h> + +#include "tdeprociotest.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; + TDEApplication app(argc, argv, TQCString("tdeprociotest")); + + printf("Welcome to the TDEProcIO Demo Application!\n"); + + + TDEProcIO p; + + p << "rev"; + + p.connect(&p, TQ_SIGNAL(processExited(TDEProcess*)), &dummy, TQ_SLOT(printMessage(TDEProcess*))); + p.connect(&p, TQ_SIGNAL(readReady(TDEProcIO*)), &dummy, TQ_SLOT(gotOutput(TDEProcIO*))); + + 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 "tdeprociotest.moc" |