EmbLogic's Blog

binarysearch using pointers

#include<stdio.h>
2 #include<stdlib.h>
3 int input(int,int *);
4 int search(int *,int,int);
5 int main()
6 {
7
8         int size=10;
9         int * ptr;
10         int i,c,s,key;
11         ptr=(int*)malloc(sizeof(int)*size);
12         c=input(size,ptr);
13         printf(“\n matrix printed are:”);
14         for(i=0;i<size;i++)
15         {
16                 printf(“elements are :%d\n”,*(ptr+i));
17         }
18          printf(“\n enter the element to be searched\n”);
19          scanf(“%d”,&key);
20         s=search(ptr,size,key);
21         printf(“key is %d”,s);
22 return 0;
23 }
24 int input(int size,int *ptr)
25 {
26 int i;
27 printf(“\n enter the matrix”);
28         for(i=0;i<size;i++)
29         {
30                 scanf(“%d”,&(*(ptr+i)));
31         }
32 }
33 int search(int *ptr,int size,int key)
int search(int *ptr,int size,int key)
34 {
35          int l=0,h=size-1,m;
36          while(l<=h)
37          {
38                 m=(l+h)/2;
39                 if(key==*(ptr+m))
40                 {
41                         printf(“element is found at %d element is %d”,m+1,key);
42                         break;
43                 }
44                 else if(key>*(ptr+m))
45                 {
46                         l=m+1;
47                 }
48                 else if(key< *(ptr+m))
49                 {
50                         h=m-1;
51                 }
52                 if(l>h)
53                 {
54                         printf(“element not found”);
55                         break;
56                 }
57         }
58         return key;
59 }

Posted in Uncategorized | Leave a comment

Swaping of two number without using third variable.

#include<stdio.h>

int main()

{

int a,b;

printf(“enter the value of a &b”);

scanf(“%d %d”,&a,&b);

printf(“value of a=%d & b=%d\n”,a ,b);

a=a+b;

b=a-b;

a=a-b;

printf(“after swaping a=%d &b=%d\n”, a,b);

return 0;

}

Posted in Uncategorized | Leave a comment

multiply array

RCS file: mularray.c,v
Working file: mularray.c
head: 1.2
branch:
locks: strict
jyotisingh: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;    selected revisions: 2
description:
input matrix a
input matrix b
logic for multiplication
print matrix
—————————-
revision 1.2    locked by: jyotisingh;
date: 2015/03/03 16:27:36;  author: jyotisingh;  state: Exp;  lines: +1 -1
modification
—————————-
revision 1.1
date: 2015/03/03 16:24:42;  author: jyotisingh;  state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

client server communication using FIFO is implemented successfully.

RCS file: client1.c,v
Working file: client1.c
head: 1.3
branch:
locks: strict
root: 1.3
access list:
symbolic names:
keyword substitution: kv
total revisions: 3; selected revisions: 3
description:
This is client1.c file
opened SERVER_FIFO in O_WRONLY mode.
prepare a request.
—————————-
revision 1.3 locked by: root;
date: 2015/03/19 06:53:15; author: root; state: Exp; lines: +9 -1
open CLIENT1_FIFO in O_RDONLY mode
read result from server through CLIENT1_FIFO from server.
—————————-
revision 1.2
date: 2015/03/19 06:19:21; author: root; state: Exp; lines: +1 -0
print pid
—————————-
revision 1.1
date: 2015/03/19 06:12:02; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Project 03: Client Server Communication using Linux and IPC, Project 6: Client Server using Inter Process Communication Mechanism | Leave a comment

SUCESSFULLY DONE IPC USING PIPES FOR 3 REQUESTING AND 3 PROCESSING CLIENTS….

RCS file: server.c,v
Working file: server.c
head: 1.4
branch:
locks: strict
root: 1.4
access list:
symbolic names:
keyword substitution: kv
total revisions: 4; selected revisions: 4
description:
This is the base file for IPC using pipes…..
Here request is sent by 3 requesting clients to the server….
The requests are received by the server…
—————————-
revision 1.4 locked by: root;
date: 2015/03/18 12:53:03; author: root; state: Exp; lines: +0 -2
Result from processing clients is forwarded back to requesting clients by the server.
Signals are used to provide synchronization and to avoid “Block on read” and Block on write conditions.
SUCESSFULLY DONE IPC USING PIPES FOR 3 REQUESTING AND 3 PROCESSING CLIENTS….
—————————-
revision 1.3
date: 2015/03/18 12:49:36; author: root; state: Exp; lines: +0 -10
Result from processing clients is received by the processing clients….
Signals are used to provide synchronization and to avoid “Block on read” or “Block on write”.
—————————-
revision 1.2
date: 2015/03/18 12:46:33; author: root; state: Exp; lines: +1 -54
Request from the requesting clients is forwarded to processing clients by the server.
—————————-
revision 1.1
date: 2015/03/18 12:43:36; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Project 03: Client Server Communication using Linux and IPC | Leave a comment

client-server using MESSAGEQUEUE

head 1.7;
access;
symbols;
locks
ashish:1.7; strict;
comment @ * @;

1.7
date 2015.03.16.21.25.33; author ashish; state Exp;
branches;
next 1.6;

1.6
date 2015.03.16.21.22.29; author ashish; state Exp;
branches;
next 1.5;

1.5
date 2015.03.16.21.17.18; author ashish; state Exp;
branches;
next 1.4;

1.4
date 2015.03.16.21.09.27; author ashish; state Exp;
branches;
next 1.3;

1.3
date 2015.03.16.21.07.19; author ashish; state Exp;
branches;
next 1.2;

1.2
date 2015.03.16.21.03.47; author ashish; state Exp;
branches;
next 1.1;

1.1
date 2015.03.16.17.18.55; author ashish; state Exp;
branches;
next ;

desc
@including the header
creating a message queue for for receing and sending the data.
creating another msgque for receiving and sending the result
@

1.7
log
@now the received result would be written in the req client using msgsnd()
@
text
@#include”header_mq.h”//header containing the header files ,a structure which is having the variable for number and operator,union semun used for semaphore,and a sem buffer//

int main()
{
int mq_req,mq_res,mq_send,mq_recv,ret,p1[2],w1,result;
char a[4],b[4];
struct mesg req;
mq_req=msgget(620,IPC_CREAT|0666);//creating the message queue for requesting which have the a unique keyid,and mode//
if(mq_req==-1)
{
printf(“error\n”);
exit(1);
}
printf(“created for sending req\n”);
mq_res=msgget(720,IPC_CREAT|0666);//creating another message queue for taking result,with another unique keyid,and the mod//
if(mq_res==-1)
{
printf(“error1\n”);
exit(1);
}
printf(“created for result\n”);
while(1)
{
mq_recv=msgrcv(mq_req,&req,sizeof(struct mesg),0,0);//s is the message receive fun() which will receive the message from the mesg queue,where the argu says,id which have been return by the mesg queue creat(),second is the ptr which will point to the message receive,then size of the mesg pntd by the ptr,mesg type,and messg flag//

if(mq_recv==-1)
{
printf(“error2\n”);
exit(1);
}
printf(“created for receiving\n”);

printf(“readed data is %d %c %d\n”,req.data.num1,req.data.operator,req.data.num2);//here the data from the client have been received by the use of mmessg recv()//
pipe(p1);//createing the pipe for accessing the procc client//
printf(“pipe1 have been created\nrfd->%d\nwfd->%d\n”,p1[0],p1[1]);
ret=fork();//fork have been done to creat a child and parent proceess//
if(ret==0)
{
printf(“child\n”);
printf(“c1\n”);
write(p1[1],&req,sizeof(struct mesg));//writing the data in the process client using write(),and doing the execl to enter in proc clint//
sprintf(a,”%d”,p1[0]);
sprintf(b,”%d”,p1[1]);
printf(“c2\n”);
// execl(“/home/ashish/ash/pj3/messagequeue/proc”,”./proc”,a,b,NULL);//use to access the proc where the switch is used to go in diff operation such as,addition,sub,div,ettc,,//
}
else
{ wait(&w1);
printf(“parent\n”);
// read(p1[0],&result,sizeof(int));//reading the result from the proc client//
printf(“server result->%d\n”,result);
mq_send=msgsnd(mq_res,&result,sizeof(int),0);//here the received result is send to the req client,where the final result is stored//
}

}
}
@

1.6
log
@result have been written to the parent by the proc client
@
text
@d50 1
a50 1
read(p1[0],&result,sizeof(int));//reading the result from the proc client//
@

1.5
log
@*** empty log message ***
@
text
@d45 1
a45 1
execl(“/home/ashish/ash/pj3/messagequeue/proc”,”./proc”,a,b,NULL);//use to access the proc where the switch is used to go in diff operation such as,addition,sub,div,ettc,,//
@

1.4
log
@writing the data received from req client to the proc client
then accessing the proc client by doing the execl.
@
text
@d45 1
a45 1
// execl(“/home/ashish/ash/pj3/messagequeue/proc”,”./proc”,a,b,NULL);//use to access the proc where the switch is used to go in diff operation such as,addition,sub,div,ettc,,//
@

1.3
log
@now a pipe is created which returns the fd for read and write.
doing a fork so that a child andd parent can be created.
reading the data before doing fork,from the req client
@
text
@d45 1
a45 1
execl(“/home/ashish/ash/pj3/messagequeue/proc”,”./proc”,a,b,NULL);//use to access the proc where the switch is used to go in diff operation such as,addition,sub,div,ettc,,//
@

1.2
log
@now putting a while loop.
in this loop furthe programming would be done
now creting a messg receving (),which will have the arg as,1.id return by the mesgque created,2.a ptr which will points to the messg to be received,3.this is the size of the message pts by the ptr,and then messg type and flag
@
text
@d32 1
@

1.1
log
@Initial revision
@
text
@d25 1
@

Posted in Project 03: Client Server Communication using Linux and IPC | Leave a comment

Conversion of string to integer successfully done.

RCS file: 14.c,v
Working file: 14.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
This is the base file for the program.
HERE STRING IS CONVERTED INTO INTEGER.
AFTER CONVERTING INTEGER ARRAY IS CONVERTED INTO AN INTEGER VARIABLE.
—————————-
revision 1.1
date: 2015/03/15 11:14:00; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Data Structures with C | Leave a comment

communication between 6 client through server using ipc is successfully done.

RCS file: header.h,v
Working file: header.h
head: 1.11
branch:
locks: strict
root: 1.11
access list:
symbolic names:
keyword substitution: kv
total revisions: 11; selected revisions: 11
description:
This is header file.
include stdio.h,unistd.h
declare prototype of invoke_req_client function
—————————-
revision 1.11 locked by: root;
date: 2015/03/10 08:27:02; author: root; state: Exp; lines: +1 -0
include signal.h
—————————-
revision 1.10
date: 2015/03/10 08:25:34; author: root; state: Exp; lines: +1 -0
declare prototype for function()
—————————-
revision 1.9
date: 2015/03/10 08:04:39; author: root; state: Exp; lines: +1 -0
declare prototype for read_result function.
—————————-
revision 1.8
date: 2015/03/10 07:43:20; author: root; state: Exp; lines: +1 -1
add ; at end of function prototype.
—————————-
revision 1.7
date: 2015/03/10 07:38:22; author: root; state: Exp; lines: +2 -1
declare prototype for write_request function.
—————————-
revision 1.6
date: 2015/03/10 07:20:40; author: root; state: Exp; lines: +1 -0
declare prototype for read_request function
—————————-
revision 1.5
date: 2015/03/10 06:50:42; author: root; state: Exp; lines: +1 -1
add ; at end of structure
—————————-
revision 1.4
date: 2015/03/10 06:47:22; author: root; state: Exp; lines: +6 -0
declare structure struct request
—————————-
revision 1.3
date: 2015/03/10 06:38:31; author: root; state: Exp; lines: +1 -0
declare prototype for invoke_pro_client
create pipes
create new process using execl
—————————-
revision 1.2
date: 2015/03/10 05:32:37; author: root; state: Exp; lines: +1 -0
include stdlib.h
—————————-
revision 1.1
date: 2015/03/10 05:14:02; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: server.c,v
Working file: server.c
head: 1.49
branch:
locks: strict
root: 1.49
access list:
symbolic names:
keyword substitution: kv
total revisions: 49; selected revisions: 49
description:
This is server.c file.
define invoke_req_client function
create 6 pipe using pipe system call
print all pipes
call invoke_req_client function in main()
—————————-
revision 1.49 locked by: root;
date: 2015/03/10 14:41:12; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.48
date: 2015/03/10 14:38:24; author: root; state: Exp; lines: +1 -0
*** empty log message ***
—————————-
revision 1.47
date: 2015/03/10 14:33:24; author: root; state: Exp; lines: +3 -3
*** empty log message ***
—————————-
revision 1.46
date: 2015/03/10 14:31:48; author: root; state: Exp; lines: +4 -4
*** empty log message ***
—————————-
revision 1.45
date: 2015/03/10 14:30:10; author: root; state: Exp; lines: +4 -4
*** empty log message ***
—————————-
revision 1.44
date: 2015/03/10 14:27:55; author: root; state: Exp; lines: +0 -1
*** empty log message ***
—————————-
revision 1.43
date: 2015/03/10 14:23:10; author: root; state: Exp; lines: +0 -2
*** empty log message ***
—————————-
revision 1.42
date: 2015/03/10 14:18:49; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.41
date: 2015/03/10 14:17:25; author: root; state: Exp; lines: +8 -6
write result to requesting client.
—————————-
revision 1.40
date: 2015/03/10 14:08:37; author: root; state: Exp; lines: +3 -1
print pid of all client
—————————-
revision 1.39
date: 2015/03/10 14:00:53; author: root; state: Exp; lines: +3 -3
*** empty log message ***
—————————-
revision 1.38
date: 2015/03/10 13:58:19; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.37
date: 2015/03/10 13:53:42; author: root; state: Exp; lines: +4 -2
kill all requesting client
—————————-
revision 1.36
date: 2015/03/10 13:40:11; author: root; state: Exp; lines: +2 -0
print pid of client 1
—————————-
revision 1.35
date: 2015/03/10 13:33:40; author: root; state: Exp; lines: +7 -0
if all signal occur then come out from while.
—————————-
revision 1.34
date: 2015/03/10 13:32:31; author: root; state: Exp; lines: +3 -3
*** empty log message ***
—————————-
revision 1.33
date: 2015/03/10 13:31:40; author: root; state: Exp; lines: +3 -3
*** empty log message ***
—————————-
revision 1.32
date: 2015/03/10 13:30:19; author: root; state: Exp; lines: +12 -2
set condition for each signal
—————————-
revision 1.31
date: 2015/03/10 13:28:18; author: root; state: Exp; lines: +2 -1
declare function2()
—————————-
revision 1.30
date: 2015/03/10 13:26:21; author: root; state: Exp; lines: +19 -6
define signal handler fro 3 signal
—————————-
revision 1.29
date: 2015/03/10 08:43:18; author: root; state: Exp; lines: +0 -1
remove pause
—————————-
revision 1.28
date: 2015/03/10 08:40:07; author: root; state: Exp; lines: +4 -6
print i
—————————-
revision 1.27
date: 2015/03/10 08:36:57; author: root; state: Exp; lines: +1 -1
pass fd to read()
—————————-
revision 1.26
date: 2015/03/10 08:35:00; author: root; state: Exp; lines: +8 -6
read one result at a time
—————————-
revision 1.25
date: 2015/03/10 08:31:14; author: root; state: Exp; lines: +1 -0
use pause system call.
—————————-
revision 1.24
date: 2015/03/10 08:28:44; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.23
date: 2015/03/10 08:27:41; author: root; state: Exp; lines: +1 -1
define storage for done variable
—————————-
revision 1.22
date: 2015/03/10 08:26:01; author: root; state: Exp; lines: +12 -1
define function()
—————————-
revision 1.21
date: 2015/03/10 08:15:31; author: root; state: Exp; lines: +4 -1
*** empty log message ***
—————————-
revision 1.20
date: 2015/03/10 08:05:07; author: root; state: Exp; lines: +12 -0
define read_result function
—————————-
revision 1.19
date: 2015/03/10 07:45:48; author: root; state: Exp; lines: +1 -1
chagne argument of write()
—————————-
revision 1.18
date: 2015/03/10 07:45:05; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.17
date: 2015/03/10 07:44:02; author: root; state: Exp; lines: +3 -3
uncomment write_request function
—————————-
revision 1.16
date: 2015/03/10 07:43:02; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.15
date: 2015/03/10 07:41:34; author: root; state: Exp; lines: +1 -1
comment write_request function
—————————-
revision 1.14
date: 2015/03/10 07:40:21; author: root; state: Exp; lines: +1 -1
correct spelling of request
—————————-
revision 1.13
date: 2015/03/10 07:38:44; author: root; state: Exp; lines: +15 -2
define write_request function
write request from server to processing client through pipe.
—————————-
revision 1.12
date: 2015/03/10 07:22:41; author: root; state: Exp; lines: +1 -1
define j
—————————-
revision 1.11
date: 2015/03/10 07:21:11; author: root; state: Exp; lines: +13 -1
define read_request function
—————————-
revision 1.10
date: 2015/03/10 06:39:47; author: root; state: Exp; lines: +36 -0
create pipes
create new process using execl
—————————-
revision 1.9
date: 2015/03/10 06:06:52; author: root; state: Exp; lines: +1 -1
correct spelling of sprintf.
—————————-
revision 1.8
date: 2015/03/10 06:04:20; author: root; state: Exp; lines: +4 -1
convert fd from integer to char using sprintf
pass rfd and wfd to each req_cl.
—————————-
revision 1.7
date: 2015/03/10 05:58:18; author: root; state: Exp; lines: +2 -1
print in default case
—————————-
revision 1.6
date: 2015/03/10 05:55:35; author: root; state: Exp; lines: +6 -5
create new process using execl in child process.
—————————-
revision 1.5
date: 2015/03/10 05:40:06; author: root; state: Exp; lines: +2 -2
comment fork()
—————————-
revision 1.4
date: 2015/03/10 05:37:28; author: root; state: Exp; lines: +0 -2
remove default case
—————————-
revision 1.3
date: 2015/03/10 05:32:52; author: root; state: Exp; lines: +1 -0
print child number.
—————————-
revision 1.2
date: 2015/03/10 05:26:27; author: root; state: Exp; lines: +19 -0
create child process using fork() in invoke_req_client function
—————————-
revision 1.1
date: 2015/03/10 05:14:02; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: multiplier.c,v
Working file: multiplier.c
head: 1.9
branch:
locks: strict
root: 1.9
access list:
symbolic names:
keyword substitution: kv
total revisions: 9; selected revisions: 9
description:
This is multiplier.c file
printf file name and rfd and wfd
—————————-
revision 1.9 locked by: root;
date: 2015/03/10 14:26:29; author: root; state: Exp; lines: +0 -2
*** empty log message ***
—————————-
revision 1.8
date: 2015/03/10 13:27:19; author: root; state: Exp; lines: +1 -1
send signal 4
—————————-
revision 1.7
date: 2015/03/10 08:15:35; author: root; state: Exp; lines: +1 -0
*** empty log message ***
—————————-
revision 1.6
date: 2015/03/10 08:06:56; author: root; state: Exp; lines: +1 -0
print request.
—————————-
revision 1.5
date: 2015/03/10 07:59:19; author: root; state: Exp; lines: +4 -3
compute result and write back to server through pipe.
—————————-
revision 1.4
date: 2015/03/10 07:53:57; author: root; state: Exp; lines: +1 -0
define structure variable r
—————————-
revision 1.3
date: 2015/03/10 07:52:50; author: root; state: Exp; lines: +1 -1
define count variable
—————————-
revision 1.2
date: 2015/03/10 07:51:51; author: root; state: Exp; lines: +3 -1
read request from server
—————————-
revision 1.1
date: 2015/03/10 06:40:29; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: adder.c,v
Working file: adder.c
head: 1.7
branch:
locks: strict
root: 1.7
access list:
symbolic names:
keyword substitution: kv
total revisions: 7; selected revisions: 7
description:
This is adder.c file
printf file name and rfd and wfd
—————————-
revision 1.7 locked by: root;
date: 2015/03/10 14:26:25; author: root; state: Exp; lines: +0 -2
*** empty log message ***
—————————-
revision 1.6
date: 2015/03/10 08:15:33; author: root; state: Exp; lines: +1 -0
*** empty log message ***
—————————-
revision 1.5
date: 2015/03/10 08:06:37; author: root; state: Exp; lines: +1 -0
print request
—————————-
revision 1.4
date: 2015/03/10 07:59:55; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.3
date: 2015/03/10 07:58:32; author: root; state: Exp; lines: +4 -3
compute result and write back to server through pipe.
—————————-
revision 1.2
date: 2015/03/10 07:51:12; author: root; state: Exp; lines: +5 -2
read request from server
—————————-
revision 1.1
date: 2015/03/10 06:40:29; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: subtractor.c,v
Working file: subtractor.c
head: 1.9
branch:
locks: strict
root: 1.9
access list:
symbolic names:
keyword substitution: kv
total revisions: 9; selected revisions: 9
description:
This is subtractor.c file
printf file name and rfd and wfd
—————————-
revision 1.9 locked by: root;
date: 2015/03/10 14:26:28; author: root; state: Exp; lines: +0 -2
*** empty log message ***
—————————-
revision 1.8
date: 2015/03/10 13:26:56; author: root; state: Exp; lines: +1 -1
send signal 3
—————————-
revision 1.7
date: 2015/03/10 08:15:34; author: root; state: Exp; lines: +1 -0
*** empty log message ***
—————————-
revision 1.6
date: 2015/03/10 08:06:50; author: root; state: Exp; lines: +1 -0
print request
—————————-
revision 1.5
date: 2015/03/10 07:59:14; author: root; state: Exp; lines: +4 -3
compute result and write back to server through pipe.
—————————-
revision 1.4
date: 2015/03/10 07:53:32; author: root; state: Exp; lines: +1 -0
define structure variable r
—————————-
revision 1.3
date: 2015/03/10 07:52:34; author: root; state: Exp; lines: +1 -1
define count variable
—————————-
revision 1.2
date: 2015/03/10 07:51:28; author: root; state: Exp; lines: +3 -1
read request from server
—————————-
revision 1.1
date: 2015/03/10 06:40:29; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: req_c1.c,v
Working file: req_c1.c
head: 1.10
branch:
locks: strict
root: 1.10
access list:
symbolic names:
keyword substitution: kv
total revisions: 10; selected revisions: 10
description:
This is req_cl1.c
file
print file name
—————————-
revision 1.10 locked by: root;
date: 2015/03/10 14:25:54; author: root; state: Exp; lines: +0 -2
use pause instead of while.
—————————-
revision 1.9
date: 2015/03/10 14:21:37; author: root; state: Exp; lines: +1 -11
*** empty log message ***
—————————-
revision 1.8
date: 2015/03/10 14:12:20; author: root; state: Exp; lines: +5 -2
*** empty log message ***
—————————-
revision 1.7
date: 2015/03/10 14:10:41; author: root; state: Exp; lines: +1 -0
*** empty log message ***
—————————-
revision 1.6
date: 2015/03/10 14:06:23; author: root; state: Exp; lines: +8 -6
print pid
—————————-
revision 1.5
date: 2015/03/10 13:54:09; author: root; state: Exp; lines: +14 -2
read result
—————————-
revision 1.4
date: 2015/03/10 13:41:39; author: root; state: Exp; lines: +1 -0
print pid
—————————-
revision 1.3
date: 2015/03/10 06:57:53; author: root; state: Exp; lines: +7 -1
write request into pipe
—————————-
revision 1.2
date: 2015/03/10 06:10:53; author: root; state: Exp; lines: +5 -1
read rfd and wfd from cmd line argument
convert fd into integer from string using atoi
—————————-
revision 1.1
date: 2015/03/10 05:56:08; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: req_c2.c,v
Working file: req_c2.c
head: 1.8
branch:
locks: strict
root: 1.8
access list:
symbolic names:
keyword substitution: kv
total revisions: 8; selected revisions: 8
description:
This is req_cl2.c file
print file name
—————————-
revision 1.8 locked by: root;
date: 2015/03/10 14:26:08; author: root; state: Exp; lines: +0 -2
use pause instead of while.
—————————-
revision 1.7
date: 2015/03/10 14:21:39; author: root; state: Exp; lines: +3 -10
*** empty log message ***
—————————-
revision 1.6
date: 2015/03/10 14:10:43; author: root; state: Exp; lines: +2 -1
*** empty log message ***
—————————-
revision 1.5
date: 2015/03/10 14:06:31; author: root; state: Exp; lines: +9 -5
print pid
—————————-
revision 1.4
date: 2015/03/10 13:54:21; author: root; state: Exp; lines: +12 -1
read result
—————————-
revision 1.3
date: 2015/03/10 06:58:23; author: root; state: Exp; lines: +7 -0
write request into pipe
—————————-
revision 1.2
date: 2015/03/10 06:12:30; author: root; state: Exp; lines: +4 -1
convert fd into integer from string using atoi
—————————-
revision 1.1
date: 2015/03/10 05:56:08; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: req_c3.c,v
Working file: req_c3.c
head: 1.8
branch:
locks: strict
root: 1.8
access list:
symbolic names:
keyword substitution: kv
total revisions: 8; selected revisions: 8
description:
This is req_c2.c file
print file name
—————————-
revision 1.8 locked by: root;
date: 2015/03/10 14:26:20; author: root; state: Exp; lines: +1 -2
use pause instead of while.
—————————-
revision 1.7
date: 2015/03/10 14:21:40; author: root; state: Exp; lines: +3 -10
*** empty log message ***
—————————-
revision 1.6
date: 2015/03/10 14:10:44; author: root; state: Exp; lines: +1 -0
*** empty log message ***
—————————-
revision 1.5
date: 2015/03/10 14:06:36; author: root; state: Exp; lines: +8 -5
print pid
—————————-
revision 1.4
date: 2015/03/10 13:54:26; author: root; state: Exp; lines: +13 -1
result
—————————-
revision 1.3
date: 2015/03/10 06:58:36; author: root; state: Exp; lines: +7 -0
write request into pipe
—————————-
revision 1.2
date: 2015/03/10 06:12:45; author: root; state: Exp; lines: +4 -1
convert fd into integer from string using atoi
—————————-
revision 1.1
date: 2015/03/10 05:56:08; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Project 03: Client Server Communication using Linux and IPC | Leave a comment

Largest Element Using Function and Array

#include <stdio.h>
int largest(int []);
int largest(int arr[5])
{
int l,i;
l = arr[0];
for(i=1;i<5;i++)
{
if (arr[i] > l)
{
l = arr[i];
}
else ;

//printf(“%d”,l);
}

return l;
}

int main()
{
int i, max;
int arr[5];
printf(“Enter Elements of array:\n”);
for(i=0;i<5;i++)
{
scanf(“%d”, &arr[i]);
}
for(i=0;i<5;i++)
{
printf(“Array->%d of %d\n:”,i,arr[i]);

}
max = largest(arr);
printf(“largest element is %d\n:”, max);
}

“largest_func.c” 38L, 476C                                                                             33,3-17       44%

Posted in Uncategorized | Leave a comment

Addition Using PASS BY VALUE

#include <stdio.h>
int add_num(int, int, int);                                              //function declaration
int add_num(int num1, int num2, int num3)               //function definition
{
int num4;
num4 = num1 + num2 + num3;                        //function body
return num4;
}
int main()
{
int i,x,y,z;
printf(“Enter three numbers:\n”);
scanf(“%d%d%d”,&x,&y,&z );
i = add_num(x,y,z);
printf(“sum of %d , %d and %d is %d:\n”,x,y,z,i
);
}

~
~
~
~
~
~
~
~
~
~
~
6,49-56       All

Posted in Uncategorized | Leave a comment

Project 03: Client Server implementation using PIPES

Here i have used 3 requesting clients and 3 processing clients.
RCS file: header1.h,v
Working file: header1.h
head:
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 0
description:
this is the header file.it contains library which are required by programs
contains prototype for functions and structures
=============================================================================
RCS file: server.c,v
Working file: server.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
this is the server program..here i have created six pipes.
3 each for requesting clients and 3 for processing clients
requesting client will send request to the server and server then transfer the info to the processing clients
processing clients will process that info and send back to the server
server will then transfer the info back to the requesting clients
i have implemented the server program using functions
—————————-
revision 1.1 locked by: root;
date: 2015/03/05 00:08:19; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: request_client.c,v
Working file: request_client.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
this is the first requesting client.
Sending request for the addtion.
—————————-
revision 1.1 locked by: root;
date: 2015/03/05 00:08:11; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: request_client_mul.c,v
Working file: request_client_mul.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
this is second requesting client
sending request for the multiplication.
—————————-
revision 1.1 locked by: root;
date: 2015/03/05 00:08:19; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: request_client_sub.c,v
Working file: request_client_sub.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
this is the third requesting client
sending request for the subtraction
—————————-
revision 1.1 locked by: root;
date: 2015/03/05 00:08:19; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: adder.c,v
Working file: adder.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
this is first processing client
here arithmetic operation”ADDITION” is performed
—————————-
revision 1.1 locked by: root;
date: 2015/03/05 00:08:19; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: mul.c,v
Working file: mul.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
this is the second processing client
here arithmetic operation “MULTIPLICATION” is performed.
—————————-
revision 1.1 locked by: root;
date: 2015/03/05 00:08:19; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: sub.c,v
Working file: sub.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
this is the third processing client.
Here arithmetic operation “SUBTRACTION” is performed.
—————————-
revision 1.1 locked by: root;
date: 2015/03/05 00:08:19; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Project 03: Client Server Communication using Linux and IPC | Tagged , , | Leave a comment

interprocess communication between files by passing fd.

 


RCS file: fdtransfer.c,v
Working file: fdtransfer.c
head: 1.2
branch:
locks: strict
	root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;	selected revisions: 2
description:
implementing communication using files(by
passing fd)
----------------------------
revision 1.2	locked by: root;
date: 2015/03/04 17:42:49;  author: root; 
state: Exp;  lines: +12 -8
*** empty log message ***
----------------------------
revision 1.1
date: 2015/03/04 17:41:25;  author: root; 
state: Exp;
Initial revision
=============================================================================

RCS file: b.c,v
Working file: b.c
head: 1.1
branch:
locks: strict
	root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;	selected revisions: 1
description:
----------------------------
revision 1.1	locked by: root;
date: 2015/03/04 17:44:56;  author: root; 
state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

Enter Elements in Array

#include <stdio.h>
int main()
{
int i,j;
int r=2,c=3;
int arr[3][4];

printf(“Enter Elements:\n”);
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
scanf(“%d”, &arr[i][j]);
}
}

printf(“Elements of Array:\n”);
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
printf(“%d \t”, arr[i][j]);
}
printf(“\n”);
}
return 0;
}

~
“2d_array.c” 28L, 357C                                                                                 6,2-9         All

Posted in Uncategorized | Leave a comment

Implemented client-server-client communication using IPC

RCS file: headerr.h,v
Working file: headerr.h
head: 1.2
branch:
locks: strict
root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
contain header files
defination of srtuct message
—————————-
revision 1.2 locked by: root;
date: 2015/03/04 06:31:37; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.1
date: 2015/03/04 06:12:19; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: server.c,v
Working file: server.c
head: 1.6
branch:
locks: strict
root: 1.6
access list:
symbolic names:
keyword substitution: kv
total revisions: 6; selected revisions: 6
description:
implement pipe
make parent nd child using fork()
—————————-
revision 1.6 locked by: root;
date: 2015/03/04 06:31:39; author: root; state: Exp; lines: +3 -4
*** empty log message ***
—————————-
revision 1.5
date: 2015/03/04 06:25:57; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.4
date: 2015/03/04 06:24:01; author: root; state: Exp; lines: +2 -1
*** empty log message ***
—————————-
revision 1.3
date: 2015/03/04 06:19:02; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.2
date: 2015/03/04 06:14:29; author: root; state: Exp; lines: +1 -1
define wfd in function invoke_pro()
—————————-
revision 1.1
date: 2015/03/04 06:12:19; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: add_req_client.c,v
Working file: add_req_client.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
declare message structure
—————————-
revision 1.1 locked by: root;
date: 2015/03/04 06:12:19; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: add_pro_client.c,v
Working file: add_pro_client.c
head: 1.3
branch:
locks: strict
root: 1.3
access list:
symbolic names:
keyword substitution: kv
total revisions: 3; selected revisions: 3
description:
declare message structure
—————————-
revision 1.3 locked by: root;
date: 2015/03/04 06:19:05; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.2
date: 2015/03/04 06:15:09; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.1
date: 2015/03/04 06:12:19; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Project 03: Client Server Communication using Linux and IPC | Leave a comment


RCS file: fdtransfer.c,v
Working file: fdtransfer.c
head: 1.3
branch:
locks: strict
	root: 1.3
access list:
symbolic names:
keyword substitution: kv
total revisions: 3;	selected revisions: 3
description:
initial program.
----------------------------
revision 1.3	locked by: root;
date: 2015/03/03 17:24:41;  author: root; 
state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.2
date: 2015/03/03 17:21:39;  author: root; 
state: Exp;  lines: +2 -2
giving the data in file by user
----------------------------
revision 1.1
date: 2015/03/03 17:15:21;  author: root; 
state: Exp;
Initial revision
=============================================================================
Posted in Uncategorized | Leave a comment