Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please Ammend/change the Following C programming code according to requirement :- Requirement :- I want to Store Multiple Lines in String as When I press

Please Ammend/change the Following C programming code according to requirement :-

Requirement :-

I want to Store Multiple Lines in String as When I press Enter , I will move to next line and when I place ";" in input, It will terminate from getting output , Mean I want to Write Data According to This Form

Name: abc

Phone :123

Address : usa ;

here I enter ";" in the last and it will terminate .

HERE the code is

#include

#include

#include

// structure for message queue

struct mesg_buffer {

long mesg_type;

char mesg_text[100];

} message;

int main()

{

key_t key;

int msgid;

// ftok to generate unique key

key = ftok("progfile", 65);

// msgget creates a message queue

// and returns identifier

msgid = msgget(key, 0666 | IPC_CREAT);

message.mesg_type = 1;

printf("Write Data : ");

gets(message.mesg_text);

// msgsnd to send message

msgsnd(msgid, &message, sizeof(message), 0);

// display the message

printf("Data send is : %s ", message.mesg_text);

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

2. What, according to Sergey, was strange at this meeting?

Answered: 1 week ago

Question

3. Are our bosses always right? If not, what should we do?

Answered: 1 week ago