This page was last modified 21:10, 26 October 2007.
Exemplos de pipes
From Forum Nokia Wiki
Original: Pipes Example
O código a seguir mostra como criar e usar pipes.
#include <unistd.h> #include <string.h> #include <sys/stat.h> #include <fcntl.h> #include <pthread.h> int pipefd[2]; unsigned int threadid; // Início da thread void* PipeWriterThread(void* arg) { char ch[32]; strcpy(ch, "abcd"); write(pipefd[1], ch, 4); return NULL; } void CreateThreadL() { pthread_create(&threadid,(pthread_attr_t *)NULL,PipeWriterThread, NULL); } int main() { if(0 == pipe(pipefd)) { char ch[128]; CreateThreadL(); read(pipefd[0], ch, 10); close(pipefd[1]); close(pipefd[0]); } return 0; }
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Handling Message Threads and Failovers | nights_out | General Messaging | 0 | 2003-05-15 11:09 |
| Problems with threads | tsharju | Python | 12 | 2007-03-02 09:34 |
| Connection not working on phone, does on emulator | mattmatt | Symbian Networking & Messaging | 1 | 2007-03-15 15:41 |
| Cannot remove Widsets from Nokia N81 | alegrange | General WidSets and Widget Discussion | 6 | 2008-07-01 18:55 |
| j2me inlining/optimisation | Sillytuna | Mobile Java General | 13 | 2004-06-29 17:51 |
