Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 06:00, 1 October 2007.

Pipes Example

From Forum Nokia Wiki

Pipes

The following code shows the creation and usage of Pipes(the code below follows the steps given in the above link):

#include <unistd.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>
 
int pipefd[2];
unsigned int threadid;
 
// thread entry point
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
Multiselect Listbox - unticked icon? parisn General Symbian C++ 4 2007-12-16 17:42
help in who to do the gprs programming flyingsea General Symbian C++ 1 2004-09-27 05:10
migrating makefile -D to mmp steverino2 Carbide.c++ and CodeWarrior Tools 4 2007-05-09 04:02
anything like Prinf or Msgbox? ntsing Bluetooth Technology 1 2002-11-26 09:35
Where should i send data by using socket example?? msudan General Symbian C++ 3 2005-04-17 16:18
 
Powered by MediaWiki