diff options
Diffstat (limited to 'tdecore/tests/tdeprocesstest.h')
-rw-r--r-- | tdecore/tests/tdeprocesstest.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tdecore/tests/tdeprocesstest.h b/tdecore/tests/tdeprocesstest.h new file mode 100644 index 000000000..32a559157 --- /dev/null +++ b/tdecore/tests/tdeprocesstest.h @@ -0,0 +1,48 @@ +// +// DUMMY -- A dummy class with a slot to demonstrate TDEProcess signals +// +// version 0.2, Aug 2nd 1997 +// +// (C) Christian Czezatke +// + + +#ifndef __DUMMY_H__ +#define __DUMMY_H__ + +#include <stdio.h> +#include <tqobject.h> +#include "tdeprocess.h" + +class Dummy : public TQObject +{ + TQ_OBJECT + + public slots: + void printMessage(TDEProcess *proc) + { + printf("Process %d exited!\n", (int)proc->getPid()); + } + + void gotOutput(TDEProcess*, char *buffer, int len) + { + char result[1025]; // this is ugly since it relys on the internal buffer size of TDEProcess, + memcpy(result, buffer, len); // NEVER do that in your own application... ;-) + result[len] = '\0'; + printf("OUTPUT>>%s", result); + } + + void outputDone(TDEProcess *proc) + /* + Slot Procedure for the "sort" example. -- If it is indicated that the "sort" command has + absorbed all its input, we send an "EOF" to it to indicate that there is no more + data to be processed. + */ + { + proc->closeStdin(); + } + +}; + +#endif |