Add to Favorites    Make Home Page 4648 Online  
 Language Categories  
 Our Services  

Home » C Home » C on Unix Home » String manipulation using message Queue

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title String manipulation using message Queue
Author raja mukesh
Author Email rajamukesh [at] gmail.com
Description This program is used to perform the string manipulation using message Queue.contains 4 programs.one program is used as the header.one
program for used to send the data int the messga queue and other two programs are used to reterive the message.
Category C » C on Unix
Hits 365850
Code Select and Copy the Code
Queue.h ------- #include<stdio.h> #include<errno.h> #include<sys/ipc.h> #include<sys/msg.h> struct queue { long type; char msg[50]; }; Queue.c ------- #include "queue.h" int main() { struct queue q; int mid; if((mid=msgget(ftok("string",0x99),0644|IPC_CREAT))<0) { if(mid!=-1) { printf("Message Queue Error "); exit(1); } else { printf("Message Already Exist "); exit(1); } } printf(" Enter the Message Type:"); scanf("%d",&q.type); while(q.type>0) { printf(" Enter the Message:"); getchar(); gets(q.msg); if(msgsnd(mid,&q,sizeof(q),IPC_NOWAIT)<0) { printf("Message send Error "); exit(1); } printf(" Enter the Message Type:"); scanf("%d",&q.type); } return 0; } Word.c ------ #include "queue.h" #include<string.h> void word(char* str) { int i,n,w=1; n=strlen(str); for(i=0;i<n;i++) if(str[i]==' ' && str[i-1]!=' ') w++; printf("Number of Words in "%s" :%d ",str,w); } int main() { struct queue q; int mid; long type; if((mid=msgget(ftok("string",0x99),0644 ))<0) { printf("Message Queue Error "); exit(1); } printf(" Enter the Message Type to Reterive:"); scanf("%d",&type); while(msgrcv(mid,&q,sizeof(q),type,IPC_NOWAIT) && errno!=ENOMSG) { word(q.msg); } msgctl(mid,IPC_RMID,NULL); } Reverse.c --------- #include "queue.h" #include<string.h> void rev(char* str) { char s[30]; int i,j,n; n=strlen(str); printf("Reverse for "%s" :",str); for(i=n;i>=0;i--) putchar(str[i]); printf(" "); } int main() { struct queue q; int mid; long type; if((mid=msgget(ftok("string",0x99),0644 ))<0) { printf("Message Queue Error "); exit(1); } printf(" Enter the Message Type to Reterive:"); scanf("%d",&type); while(msgrcv(mid,&q,sizeof(q),type,IPC_NOWAIT) && errno!=ENOMSG) { rev(q.msg); } }

Related Source Codes

Script Name Author
The Game Opposite as seen on Nokia 2300 Mobile Manikanta
RECURSIVE BALANCED QUICK SORT ashish
Radix Sort ashish
Change your mouse pointer Ashim
The blinking star Shashank
Data Validation Crylittlebaby
To search a file by giving file type like mp3 or mpeg or doc Prashanth SR
Menus Demonstration B.Chidhambaram
Employee Database Project Using C. Reenku Raman Nayak
Creating a Lexical Analyzer in c fahad bader al-buhairi ¦Õ¤ ?¤Ð Ãß??ÝÐÝ
Calendar Program Omkar & Devendra
Stop double Process for start in C Cedrik Jurak
Stop double Process for start in C Cedrik Jurak
Time Scheduler Atiq Anwar
A timepass game between atmost two players Rahul Roy

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=670


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review