<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EmbLogic &#187; Raman Pandey</title>
	<atom:link href="https://www.emblogic.com/blog/author/aspiration403/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.emblogic.com/blog</link>
	<description>Embedded System and ARM Training</description>
	<lastBuildDate>Tue, 03 Mar 2020 13:00:06 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
	<item>
		<title>Passing a local variable in thread function</title>
		<link>https://www.emblogic.com/blog/12/passing-a-local-variable-in-thread-function/</link>
		<comments>https://www.emblogic.com/blog/12/passing-a-local-variable-in-thread-function/#comments</comments>
		<pubDate>Wed, 16 Dec 2015 11:51:44 +0000</pubDate>
		<dc:creator><![CDATA[Raman Pandey]]></dc:creator>
				<category><![CDATA[Data Structures with C]]></category>
		<category><![CDATA[Project 03: Client Server Communication using Linux and IPC]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=13069</guid>
		<description><![CDATA[if we simply pass the address of local variable to a thread function then when that function ends then address of that variable lost(if variable is automatic) and we try to access that address or variable the it doesn&#8217;t give &#8230; <a href="https://www.emblogic.com/blog/12/passing-a-local-variable-in-thread-function/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>if we simply pass the address of local variable to a thread function then when that function ends then address of that variable lost(if variable is automatic)  and we try to access that address or variable the it doesn&#8217;t give correct result .</p>
<p>I&#8217;ve resolved this problem by this way:<br />
If i take a local variable pointer and malloc it and then pass it. when we malloc then it falls in heap segment and the it exist for the whole lifetime of program.</p>
<p>Please comment if any issue.  </p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/12/passing-a-local-variable-in-thread-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>what is the error in following code?</title>
		<link>https://www.emblogic.com/blog/07/what-is-the-error-in-following-code/</link>
		<comments>https://www.emblogic.com/blog/07/what-is-the-error-in-following-code/#comments</comments>
		<pubDate>Fri, 25 Jul 2014 07:51:10 +0000</pubDate>
		<dc:creator><![CDATA[Raman Pandey]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11294</guid>
		<description><![CDATA[Point out the error in the following program. #include #include void varfun(int n, &#8230;); int main() { varfun(3, 7, -11.2, 0.66); return 0; } void varfun(int n, &#8230;) { float *ptr; int num; va_start(ptr, n); num = va_arg(ptr, int); printf(&#8220;%d&#8221;, &#8230; <a href="https://www.emblogic.com/blog/07/what-is-the-error-in-following-code/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Point out the error in the following program.<br />
#include<br />
#include<br />
void varfun(int n, &#8230;);</p>
<p>int main()<br />
{<br />
    varfun(3, 7, -11.2, 0.66);<br />
    return 0;<br />
}<br />
void varfun(int n, &#8230;)<br />
{<br />
    float *ptr;<br />
    int num;<br />
    va_start(ptr, n);<br />
    num = va_arg(ptr, int);<br />
    printf(&#8220;%d&#8221;, num);<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/what-is-the-error-in-following-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>is there any structure declaration in header file ?</title>
		<link>https://www.emblogic.com/blog/07/is-there-any-structure-declaration-in-header-file/</link>
		<comments>https://www.emblogic.com/blog/07/is-there-any-structure-declaration-in-header-file/#comments</comments>
		<pubDate>Fri, 25 Jul 2014 07:01:56 +0000</pubDate>
		<dc:creator><![CDATA[Raman Pandey]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11292</guid>
		<description><![CDATA[A header file contains macros, structure declaration and function prototypes. A. True B.false]]></description>
				<content:encoded><![CDATA[<p> A header file contains macros, structure declaration and function prototypes.<br />
 A. True<br />
 B.false </p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/is-there-any-structure-declaration-in-header-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>what will answer of this qn.</title>
		<link>https://www.emblogic.com/blog/07/what-will-answer-of-this-qn/</link>
		<comments>https://www.emblogic.com/blog/07/what-will-answer-of-this-qn/#comments</comments>
		<pubDate>Fri, 25 Jul 2014 06:45:49 +0000</pubDate>
		<dc:creator><![CDATA[Raman Pandey]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11290</guid>
		<description><![CDATA[In which order do the following gets evaluated 1. Relational 2. Arithmetic 3. Logical 4. Assignment]]></description>
				<content:encoded><![CDATA[<p>
In which order do the following gets evaluated<br />
1. Relational<br />
2. Arithmetic<br />
3. Logical<br />
4. Assignment </p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/what-will-answer-of-this-qn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>program for stack using link list</title>
		<link>https://www.emblogic.com/blog/07/program-for-stack-using-link-list/</link>
		<comments>https://www.emblogic.com/blog/07/program-for-stack-using-link-list/#comments</comments>
		<pubDate>Fri, 18 Jul 2014 09:33:59 +0000</pubDate>
		<dc:creator><![CDATA[Raman Pandey]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11124</guid>
		<description><![CDATA[head 1.5; access; symbols; locks root:1.5; strict; comment @ * @; 1.5 date 2014.07.17.03.57.50; author root; state Exp; branches; next 1.4; 1.4 date 2014.07.16.13.55.28; author root; state Exp; branches; next 1.3; 1.3 date 2014.07.16.13.52.30; author root; state Exp; branches; next &#8230; <a href="https://www.emblogic.com/blog/07/program-for-stack-using-link-list/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>head	1.5;<br />
access;<br />
symbols;<br />
locks<br />
	root:1.5; strict;<br />
comment	@ * @;</p>
<p>1.5<br />
date	2014.07.17.03.57.50;	author root;	state Exp;<br />
branches;<br />
next	1.4;</p>
<p>1.4<br />
date	2014.07.16.13.55.28;	author root;	state Exp;<br />
branches;<br />
next	1.3;</p>
<p>1.3<br />
date	2014.07.16.13.52.30;	author root;	state Exp;<br />
branches;<br />
next	1.2;</p>
<p>1.2<br />
date	2014.07.16.13.48.56;	author root;	state Exp;<br />
branches;<br />
next	1.1;</p>
<p>1.1<br />
date	2014.07.16.13.04.04;	author root;	state Exp;<br />
branches;<br />
next	;</p>
<p>desc<br />
@created main menu and give the choice<br />
declare structure in which one data is info and another is next pointer<br />
of structure type<br />
set the top pointr to -1<br />
@</p>
<p>1.5<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@#include<br />
#include<br />
static int top=-1;<br />
int size;<br />
struct link<br />
{<br />
	int info;<br />
	struct link *next;<br />
};<br />
struct link *create_node()<br />
{<br />
	struct link *temp;<br />
	top++;<br />
	temp=(struct link *)malloc(sizeof(struct link));<br />
	printf(&#8220;please enter  data :\n&#8221;);<br />
	scanf(&#8220;%d&#8221;,&amp;temp-&gt;info);	</p>
<p>	temp-&gt;next=NULL;<br />
	return temp;</p>
<p>}<br />
struct link *push(struct link *temp)<br />
{<br />
	struct link *push=temp;</p>
<p>		while(push-&gt;next!=NULL)<br />
		{<br />
			push=push-&gt;next;<br />
		}<br />
		push-&gt;next=create_node();<br />
		push=push-&gt;next;</p>
<p>}<br />
 pop(struct link *temp)<br />
{<br />
	struct link *temp1=temp-&gt;next;<br />
	/*while(temp1)<br />
	{<br />
		temp-&gt;info=temp1-&gt;info;<br />
		if(temp1-&gt;next==NULL)<br />
		{</p>
<p>			temp-&gt;next=NULL;<br />
			free(temp1);<br />
			break;</p>
<p>		}<br />
		else<br />
		{	temp=temp1;<br />
			temp1=temp-&gt;next;<br />
	}	}<br />
//	temp=NULL;*/<br />
	while(temp-&gt;next)<br />
	{<br />
		temp1=temp-&gt;next;<br />
		if(temp1-&gt;next==NULL)<br />
		{<br />
			temp-&gt;next=NULL;<br />
			free(temp1);<br />
			break;<br />
		}<br />
		temp=temp-&gt;next;</p>
<p>	}<br />
	top&#8211;;<br />
}</p>
<p>display(struct link *disp)<br />
{<br />
	printf(&#8220;\n stack is :\n&#8221;);<br />
	while(disp)<br />
	{<br />
		printf(&#8220;%d \n&#8221;,disp-&gt;info);<br />
		disp=disp-&gt;next;<br />
	}</p>
<p>}<br />
getchoice(int choice)<br />
{<br />
	static int flag=0;<br />
	static struct link *start,*new;<br />
	switch(choice)<br />
	{<br />
		case 1:<br />
			if(top==-1 )<br />
			{<br />
				start=new=create_node();<br />
				flag=1;<br />
			}<br />
			else<br />
				printf(&#8220;push the data stack is already created\n&#8221;);<br />
				break;</p>
<p>		case 2:if(top&lt;size-1 &amp;&amp; flag)<br />
			{<br />
			push(new);<br />
			}<br />
			else if(top-1)<br />
				pop(start);<br />
			else<br />
				printf(&#8220;stack is empty\n&#8221;);<br />
			break;<br />
		case 4:<br />
			if(top&gt;-1)<br />
				display(start);<br />
			else<br />
				printf(&#8220;create stack first \n&#8221;);<br />
			break;<br />
		case 0:<br />
			exit(0);<br />
			break;<br />
		default:<br />
			printf(&#8220;enter right choice !!\n&#8221;);<br />
	}<br />
	return 0;<br />
}</p>
<p>int main()<br />
{<br />
	int choice;<br />
	printf(&#8220;enter the size of stack \n&#8221;);<br />
	scanf(&#8220;%d&#8221;,&amp;size);<br />
	while(1)<br />
	{<br />
		printf(&#8220;____MAIN MENU___\n&#8221;);<br />
		printf(&#8220;____1.CREATE STACK__\n&#8221;);<br />
		printf(&#8220;____2.PUSH _____\n&#8221;);<br />
		printf(&#8220;____3.POP _____\n&#8221;);<br />
		printf(&#8220;____4.DISPLAY ____\n&#8221;);<br />
		printf(&#8220;____0.EXIT _____\n&#8221;);<br />
		printf(&#8220;enter choice :\n&#8221;);<br />
		scanf(&#8220;%d&#8221;,&amp;choice);<br />
		getchoice(choice);<br />
	}<br />
	return 0;<br />
}<br />
@</p>
<p>1.4<br />
log<br />
@remove error<br />
@<br />
text<br />
@d15 2<br />
a16 1</p>
<p>a24 9<br />
	int flag=0;<br />
	if(top==0&amp;&amp; !flag)<br />
	{<br />
		printf(&#8220;enter  data :\n&#8221;);<br />
		scanf(&#8220;%d&#8221;,&amp;push-&gt;info);<br />
		flag=1;<br />
	}<br />
	else<br />
	{<br />
d26 1<br />
a26 1<br />
		while(push)<br />
d31 1<br />
d33 32<br />
a64 2<br />
		printf(&#8220;enter  data :\n&#8221;);<br />
		scanf(&#8220;%d&#8221;,&amp;push-&gt;next-&gt;info);<br />
d66 12<br />
a77 1</p>
<p>d81 2<br />
a82 2<br />
	int flag=0;<br />
	struct link *start,*new;<br />
d86 1<br />
a86 1<br />
			if(top==-1 &amp;&amp; !flag)<br />
d91 2<br />
d96 1<br />
d98 3<br />
d102 1<br />
a102 1<br />
				printf(&#8220;stack is full or stack create first\n&#8221;);<br />
d105 10<br />
d133 1<br />
a133 1<br />
		printf(&#8220;____1.CREATE STACK__&#8221;);<br />
@</p>
<p>1.3<br />
log<br />
@declear size<br />
@<br />
text<br />
@d27 1<br />
a27 1<br />
		printf(&#8220;enter  data :\n&#8221;)<br />
d40 1<br />
a40 1<br />
		printf(&#8220;enter  data :\n&#8221;)<br />
@</p>
<p>1.2<br />
log<br />
@making the getchoice function and then creat_node function<br />
create node funtion create the data space<br />
and then push fucntion write the data in created space<br />
@<br />
text<br />
@d4 1<br />
a4 1<br />
int stack_size;<br />
d79 1<br />
a79 1<br />
	scanf(&#8220;%d&#8221;,&amp;stack_size);<br />
@</p>
<p>1.1<br />
log<br />
@Initial revision<br />
@<br />
text<br />
@d10 64<br />
a73 1</p>
<p>d83 4<br />
a86 3<br />
		printf(&#8220;____1.PUSH _____\n&#8221;);<br />
		printf(&#8220;____2.POP _____\n&#8221;);<br />
		printf(&#8220;____3.DISPLAY ____\n&#8221;);<br />
d90 1<br />
@</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/program-for-stack-using-link-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>link list operation</title>
		<link>https://www.emblogic.com/blog/07/link-list-operation/</link>
		<comments>https://www.emblogic.com/blog/07/link-list-operation/#comments</comments>
		<pubDate>Fri, 11 Jul 2014 09:19:31 +0000</pubDate>
		<dc:creator><![CDATA[Raman Pandey]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10908</guid>
		<description><![CDATA[&#8212;test&#8212;&#8212;&#8211; #! /bin/bash rcs -i header.h rcs -i llist_ato_sir.c ci header.h ci llist_ato_sir.c co header.h co llist_ato_sir.c gcc -o result llist_ato_sir.c ./result rm -rf header.h rm -rf llist_ato_sir.c rm -rf result //&#8212;&#8212;-header file&#8212;&#8212; @#include #include struct link { int info; &#8230; <a href="https://www.emblogic.com/blog/07/link-list-operation/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>&#8212;test&#8212;&#8212;&#8211;<br />
#! /bin/bash<br />
rcs -i header.h<br />
rcs -i llist_ato_sir.c<br />
ci header.h<br />
ci llist_ato_sir.c<br />
co  header.h<br />
co  llist_ato_sir.c<br />
gcc -o result  llist_ato_sir.c<br />
./result<br />
rm -rf header.h<br />
rm -rf llist_ato_sir.c<br />
rm -rf result</p>
<p>//&#8212;&#8212;-header file&#8212;&#8212;<br />
@#include<br />
#include<br />
struct link<br />
{<br />
	int info;<br />
	struct link *next;<br />
};<br />
static int node_no=0;<br />
struct link *creat_node();<br />
struct link *delete_node(struct link *);<br />
int delete_at_end(struct link *);<br />
struct link* delete_at_beg(struct link *);<br />
int delete_at_pos(struct link *);<br />
struct link * delete_key(struct link *);<br />
struct link *insert_node(struct link *);<br />
struct link *node_at_beg(struct link *);<br />
int node_at_pos(struct link *);<br />
int node_at_end(struct link *);<br />
int node_key(struct link *);<br />
int traverse_ll(struct link *);<br />
int getchoice(int );<br />
int search_element(struct link *);<br />
@</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;link list main function&#8212;&#8212;&#8211;<br />
@#include&#8221;header.h&#8221;<br />
struct link *create_node()<br />
{</p>
<p>	struct link *temp;<br />
	temp=(struct link *)malloc(sizeof(struct link));<br />
	printf(&#8220;\n enter the data :&#8221;);<br />
	scanf(&#8220;%d&#8221;,&amp;temp-&gt;info);<br />
	temp-&gt;next=NULL;<br />
	node_no++;<br />
	return temp;<br />
}<br />
delete_at_end(struct link *temp)<br />
{<br />
	struct link *end,*p;<br />
	end=temp;<br />
	while(end-&gt;next!=NULL)<br />
	{<br />
		p=end;<br />
		end=end-&gt;next;<br />
	}<br />
	p-&gt;next=NULL;<br />
	free(end);<br />
	return 0;<br />
}</p>
<p>struct link* delete_at_beg(struct link *temp)<br />
{<br />
	struct link *beg;<br />
	beg=temp;<br />
	temp=beg-&gt;next;<br />
	free(beg);</p>
<p>	return temp;<br />
}<br />
delete_at_pos(struct link *temp)<br />
{<br />
	int node,i;<br />
	struct link *nnode=temp,*pnode=temp,*r=NULL;<br />
	printf(&#8220;\n you have %d node&#8221;,node_no);<br />
	printf(&#8220;\n which node you want to delete&#8221;);<br />
	scanf(&#8220;%d&#8221;,&amp;node);<br />
	 if(node==2)<br />
	{</p>
<p>		struct link *p,*q;</p>
<p>		p=temp-&gt;next;<br />
		q=p-&gt;next;<br />
		temp-&gt;next=q;</p>
<p>		free(p);<br />
		node_no&#8211;;</p>
<p>	}<br />
	else<br />
	{<br />
		for(i=0;inext;</p>
<p>		}</p>
<p>		for(i=0;inext;</p>
<p>		}<br />
		pnode-&gt;next=nnode;<br />
		node_no&#8211;;<br />
	}<br />
	return 0;</p>
<p>}<br />
struct link *delete_key(struct link *temp)<br />
{<br />
	int val,flag=0;<br />
	struct link *p=temp,*r;<br />
	printf(&#8220;\n enter the value whose node you want to delete :\n&#8221;);<br />
	scanf(&#8220;%d&#8221;,&amp;val);<br />
	if(val==temp-&gt;info)<br />
	{<br />
		flag=1;<br />
		node_no&#8211;;<br />
		temp=temp-&gt;next;<br />
		free(p);<br />
		return temp;<br />
	}<br />
	else<br />
	{<br />
	while(p!=NULL)<br />
	{<br />
		if(p-&gt;info==val)<br />
		{<br />
			r-&gt;next=p-&gt;next;<br />
			flag=1;<br />
			node_no&#8211;;<br />
			free(p);<br />
			break;</p>
<p>		}<br />
		r=p;<br />
		p=p-&gt;next;</p>
<p>	}<br />
	}<br />
	if(flag==0)<br />
	{<br />
		printf(&#8220;\n entered data is not present in link list \n&#8221;);</p>
<p>	}<br />
	return temp;<br />
}<br />
struct link*delete_node(struct link *temp)<br />
{</p>
<p>	printf(&#8220;\n\t 1.delete node at begining&#8221;);</p>
<p>	printf(&#8220;\n\t 2. delete node at position&#8221;);<br />
	printf(&#8220;\n\t 3.delete node at end&#8221;);<br />
	printf(&#8220;\n\t 4.delete node at key value&#8221;);<br />
	int choice;<br />
	printf(&#8220;\n enter your choice :&#8221;);<br />
	scanf(&#8220;%d&#8221;,&amp;choice);</p>
<p>	switch(choice)<br />
	{<br />
		case 1:<br />
			temp=delete_at_beg(temp);<br />
			break;<br />
		case 2:<br />
			delete_at_pos(temp);<br />
			break;<br />
		case 3:<br />
			delete_at_end(temp);<br />
			break;<br />
		case 4:<br />
			temp=delete_key(temp);<br />
			break;<br />
		default:<br />
			printf(&#8220;\n \aenter right choice&#8221;);<br />
	}<br />
	return temp;<br />
}</p>
<p>/*struct link *delete_node(struct link *temp)<br />
{<br />
	int node,i;<br />
	struct link *nnode=temp,*pnode=temp,*r=NULL;<br />
	printf(&#8220;\n you have %d node&#8221;,node_no);<br />
	printf(&#8220;\n which node you want to delete&#8221;);<br />
	scanf(&#8220;%d&#8221;,&amp;node);<br />
	if(node==1)<br />
	{<br />
		struct link *q;<br />
		//q=(struct link *)malloc(sizeof(struct link));<br />
		q=temp;<br />
		temp=temp-&gt;next;</p>
<p>		free(q);</p>
<p>		node_no&#8211;;<br />
	}<br />
	else if(node==2)<br />
	{<br />
	//	nnode=temp-&gt;next;<br />
	//	nnode=nnode-&gt;next;<br />
		struct link *p,*q;<br />
		p=(struct link *)malloc(sizeof(struct link));<br />
		p=temp-&gt;next;<br />
		q=temp-&gt;next;<br />
		q=q-&gt;next;<br />
		//temp-&gt;next=temp-&gt;next-&gt;next;</p>
<p>		free(p);<br />
		node_no&#8211;;</p>
<p>	}<br />
	else<br />
	{<br />
		for(i=0;inext;</p>
<p>		}</p>
<p>		for(i=0;inext;<br />
		}<br />
		pnode-&gt;next=nnode;<br />
		node_no&#8211;;<br />
	}<br />
		return temp;<br />
}*/<br />
struct link *node_at_beg(struct link *temp)<br />
{<br />
	struct link *beg;<br />
	beg=create_node();<br />
	beg-&gt;next=temp;</p>
<p>	return beg;<br />
}<br />
node_at_pos(struct link *temp)<br />
{<br />
	int position,i;<br />
	struct link *new,*pos=temp;<br />
	printf(&#8220;\n no. of node in link list :%d&#8221;,node_no);<br />
	printf(&#8220;\n please enter the position where you want to insert node :&#8221;);<br />
	scanf(&#8220;%d&#8221;,&amp;position);<br />
	if(position&gt;node_no)<br />
	{<br />
		printf(&#8220;\n enter the position less than total node ..!!&#8221;);<br />
		goto out;<br />
	}<br />
	new=create_node();<br />
	for(i=1;inext;<br />
	}<br />
	new-&gt;next=pos;<br />
	for(i=1;inext;<br />
	}<br />
	temp-&gt;next=new;<br />
	return 0;<br />
	out:<br />
		return 0;<br />
}<br />
node_at_end(struct link *temp)<br />
{<br />
	struct link *end;</p>
<p>	end=create_node();<br />
	while(temp-&gt;next!=NULL)<br />
	{<br />
		temp=temp-&gt;next;<br />
	}</p>
<p>	temp-&gt;next=end;<br />
	return 0;<br />
}	</p>
<p>node_key(struct link *temp)<br />
{<br />
	int val,count=0;</p>
<p>	struct link *key=temp,*insert;<br />
	printf(&#8220;\n enter the key value where you want to add node :&#8221;);<br />
	scanf(&#8220;%d&#8221;,&amp;val);<br />
	while(key!=NULL)<br />
	{<br />
		if(val==key-&gt;info)<br />
		{<br />
			insert=create_node();<br />
			insert-&gt;next=key-&gt;next;<br />
			key-&gt;next=insert;<br />
			count++;<br />
			break;<br />
		}<br />
		key=key-&gt;next;<br />
	}<br />
	if(count==0)</p>
<p>		printf(&#8220;\n key value is not present in link list&#8221;);<br />
	return 0;<br />
}<br />
struct link *insert_node(struct link *temp)<br />
{<br />
	printf(&#8220;\n\t 1.insert node at begining&#8221;);</p>
<p>	printf(&#8220;\n\t 2. insert node at position&#8221;);<br />
	printf(&#8220;\n\t 3.insert node at end&#8221;);<br />
	printf(&#8220;\n\t 4.insert node at key value&#8221;);<br />
	int choice;<br />
	printf(&#8220;\n enter choice:&#8221;);<br />
	scanf(&#8220;%d&#8221;,&amp;choice);<br />
	switch(choice)<br />
	{<br />
		case 1:<br />
			temp=node_at_beg(temp);<br />
			break;<br />
		case 2:<br />
			node_at_pos(temp);<br />
			break;<br />
		case 3:<br />
			node_at_end(temp);<br />
			break;<br />
		case 4:<br />
			node_key(temp);<br />
			break;<br />
		default:<br />
			printf(&#8220;\n \aenter right choice&#8221;);<br />
	}</p>
<p>	return temp;<br />
}</p>
<p>traverse_llist(struct link *temp)<br />
{<br />
	while(temp!=NULL)<br />
	{<br />
		printf(&#8220;\n node no.&#8212;&gt; %d&#8221;,temp-&gt;info);<br />
		temp=temp-&gt;next;<br />
	}<br />
	return 0;<br />
}<br />
search_element(struct link *temp)<br />
{<br />
	int no,count=0,flag=0;<br />
	printf(&#8220;\n enter the no. which you want to search :&#8221;);<br />
	scanf(&#8220;%d&#8221;,&amp;no);<br />
	while(temp!=NULL)<br />
	{<br />
		count++;<br />
		if(no==temp-&gt;info)<br />
		{<br />
			flag=1;<br />
			printf(&#8220;\nyour search for %d  found&#8221;,no);<br />
			break;<br />
		}<br />
		temp=temp-&gt;next;<br />
	}<br />
	if(flag==0)<br />
	{<br />
		printf(&#8220;\nyour searching no. is not present in link list&#8221;);<br />
	}<br />
	return 0;<br />
}<br />
getchoice(int choice)<br />
{</p>
<p>	static int flag=0;<br />
	struct link *new,*start;<br />
	switch(choice)<br />
	{</p>
<p>		case 1:<br />
			if(flag==0)<br />
			{<br />
				new=start=create_node();<br />
				printf(&#8220;\n link list created&#8221;);<br />
				flag=1;<br />
			}<br />
			else<br />
				printf(&#8220;\n link list created already&#8221;);<br />
				break;</p>
<p>		case 2:<br />
			if(flag==1)<br />
			new=insert_node(new);<br />
			else<br />
				printf(&#8220;\n create link list first&#8221;);<br />
			break;<br />
		case 3:<br />
			if(flag==1)<br />
			new=delete_node(new);<br />
			else<br />
				printf(&#8220;\n create link list first&#8221;);<br />
			break;<br />
		case 4:<br />
			if(flag==1)<br />
			traverse_llist(new);<br />
			else<br />
				printf(&#8220;\n create link list first&#8221;);<br />
			break;<br />
		case 5:<br />
			search_element(new);<br />
			break;<br />
		case 6:<br />
	//		sorting_element();<br />
			break;<br />
		default:<br />
			printf(&#8220;enter right choice&#8221;);</p>
<p>		case 0:<br />
			exit(0);</p>
<p>	}<br />
	return 0;</p>
<p>}</p>
<p>int main()<br />
{<br />
	int choice;<br />
	printf(&#8220;&#8212;&#8212;-MAIN MENU&#8212;&#8212;&#8212;-&#8221;);<br />
	while(1)<br />
	{<br />
		printf(&#8220;\n  1.CREATE LINk LIST&#8212;&#8212;&#8212;&#8221;);<br />
		printf(&#8220;\n  2.INSERT NODE&#8212;&#8212;&#8212;&#8212;&#8211;&#8221;);<br />
		printf(&#8220;\n  3.DELETE NODE&#8212;&#8212;&#8212;&#8212;&#8211;&#8221;);<br />
		printf(&#8220;\n  4.TRAVERSE LINK LIST&#8212;&#8212;-&#8221;);<br />
		printf(&#8220;\n  5.SEARCHING ELEMENT________&#8221;);<br />
		printf(&#8220;\n  6.SORTING ELEMENT__________&#8221;);<br />
		printf(&#8220;\n  0.EXIT LINKLIST___________&#8221;);<br />
		printf(&#8220;\n enter choice :&#8221;);<br />
		scanf(&#8220;%d&#8221;,&amp;choice);<br />
		getchoice(choice);<br />
	}<br />
	return 0;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/link-list-operation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>different operation on link list</title>
		<link>https://www.emblogic.com/blog/07/different-operation-on-link-list/</link>
		<comments>https://www.emblogic.com/blog/07/different-operation-on-link-list/#comments</comments>
		<pubDate>Fri, 11 Jul 2014 09:06:08 +0000</pubDate>
		<dc:creator><![CDATA[Raman Pandey]]></dc:creator>
				<category><![CDATA[Data Structures with C]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10901</guid>
		<description><![CDATA[operation on link list which i&#8217;ve performed: 1.creation of link list, 2.insertion of node a.at begining, b.at end, c.at any position d.at any key value(if a certain element is present then insert this node) 3.traverse on link list 4.searching of &#8230; <a href="https://www.emblogic.com/blog/07/different-operation-on-link-list/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>operation on link list which i&#8217;ve performed:<br />
1.creation of link list,<br />
2.insertion of node<br />
a.at begining,<br />
b.at end,<br />
c.at any position<br />
d.at any key value(if a certain element is present then insert this node)<br />
3.traverse on link list<br />
4.searching of any element<br />
5.deletion of node<br />
a.deletion of first most node<br />
b.at end<br />
c.at any position<br />
d.at key value(deletion of a particular element)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
RCS file: llist_ato_sir.c,v<br />
Working file: llist_ato_sir.c<br />
head: 1.24<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 24;	selected revisions: 24<br />
description:<br />
created the main menu<br />
accroding to main menu ,i&#8217;ve made a choice function<br />
which has the function call of all choices<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.24<br />
date: 2014/07/11 08:49:37;  author: root;  state: Exp;  lines: +1 -1<br />
resolve error<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.23<br />
date: 2014/07/11 08:47:33;  author: root;  state: Exp;  lines: +8 -1<br />
correct the problem of insert_node_pos()<br />
keeping the entered node position less than total node<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.22<br />
date: 2014/07/11 08:42:15;  author: root;  state: Exp;  lines: +1 -1<br />
resolve the error<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.21<br />
date: 2014/07/11 08:40:54;  author: root;  state: Exp;  lines: +1 -1<br />
give the argument to search_element function<br />
base address is argument<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.20<br />
date: 2014/07/11 08:39:55;  author: root;  state: Exp;  lines: +25 -7<br />
define the search_element function<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.19<br />
date: 2014/07/11 08:25:22;  author: root;  state: Exp;  lines: +15 -3<br />
make the delete_key for compatible for first node<br />
for doing this i&#8217;ve used if else condition<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.18<br />
date: 2014/07/11 08:03:10;  author: root;  state: Exp;  lines: +13 -7<br />
resolve the problem of delete_key()<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.17<br />
date: 2014/07/11 07:50:06;  author: root;  state: Exp;  lines: +20 -0<br />
giving definition to delete_key function<br />
this function take the value<br />
if that value is present in any node<br />
then that node will deleted<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.16<br />
date: 2014/07/11 05:01:09;  author: root;  state: Exp;  lines: +1 -1<br />
*** empty log message ***<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.15<br />
date: 2014/07/11 04:57:52;  author: root;  state: Exp;  lines: +8 -5<br />
given definition of delete_at_beg()<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.14<br />
date: 2014/07/11 04:51:50;  author: root;  state: Exp;  lines: +4 -3<br />
correct the error in function delete_nod_pos()<br />
for position 2<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.13<br />
date: 2014/07/11 04:46:39;  author: root;  state: Exp;  lines: +38 -0<br />
definr delete_at_pos() function<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.12<br />
date: 2014/07/11 04:14:35;  author: root;  state: Exp;  lines: +8 -6<br />
*** empty log message ***<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.11<br />
date: 2014/07/11 03:57:36;  author: root;  state: Exp;  lines: +2 -3<br />
modify the delete_node()<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.10<br />
date: 2014/07/11 03:54:17;  author: root;  state: Exp;  lines: +55 -13<br />
making function for delete operation<br />
define delete_node()<br />
then defined delete_at_end() only for now<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.9<br />
date: 2014/07/11 03:25:22;  author: root;  state: Exp;  lines: +3 -2<br />
puting the header file in header.h<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.8<br />
date: 2014/07/11 01:44:38;  author: root;  state: Exp;  lines: +25 -12<br />
created inser at key value function<br />
this function insert node when the key value(if a certain value is present)<br />
then it will insert a node<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.7<br />
date: 2014/07/10 14:12:57;  author: root;  state: Exp;  lines: +43 -20<br />
creating insertion at key value<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6<br />
date: 2014/07/10 10:07:09;  author: root;  state: Exp;  lines: +94 -6<br />
*** empty log message ***<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2014/07/10 03:08:51;  author: root;  state: Exp;  lines: +6 -1<br />
*** empty log message ***<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2014/07/10 02:27:34;  author: root;  state: Exp;  lines: +51 -5<br />
created the insert node function<br />
in which we can insert node at beg,at end and at any position<br />
but for now i&#8217;ve only made insertion of node at end<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2014/07/10 01:57:31;  author: root;  state: Exp;  lines: +28 -8<br />
making the traverse function<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/07/10 01:41:22;  author: root;  state: Exp;  lines: +13 -1<br />
created the link list function<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/07/10 01:27:12;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================<br />
&#8212;&#8212;&#8212;-header.h file&#8212;&#8212;&#8212;&#8212;&#8212;<br />
RCS file: ./header.h,v<br />
Working file: header.h<br />
head: 1.6<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 6;	selected revisions: 6<br />
description:<br />
created header in which declare all the header file and the<br />
function prototype<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6<br />
date: 2014/07/11 08:39:30;  author: root;  state: Exp;  lines: +1 -1<br />
declare the prototype of search_element function<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2014/07/11 08:24:50;  author: root;  state: Exp;  lines: +1 -1<br />
change the return type of delete_key();<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2014/07/11 05:00:28;  author: root;  state: Exp;  lines: +1 -1<br />
modify the prototype of delete_node_at_beg()<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2014/07/11 04:13:43;  author: root;  state: Exp;  lines: +1 -1<br />
correct the declaration of delete_key()<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/07/11 03:51:55;  author: root;  state: Exp;  lines: +4 -0<br />
decleared the prototype of delete_node<br />
in reference to delete the is also four delete position declearation<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/07/11 03:25:22;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/different-operation-on-link-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>client server communication using pipe and signal</title>
		<link>https://www.emblogic.com/blog/07/client-server-communication-using-pipe-and-signal/</link>
		<comments>https://www.emblogic.com/blog/07/client-server-communication-using-pipe-and-signal/#comments</comments>
		<pubDate>Sun, 06 Jul 2014 13:05:09 +0000</pubDate>
		<dc:creator><![CDATA[Raman Pandey]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10824</guid>
		<description><![CDATA[&#8212;in this program i&#8217;ve used the pipe for communication between server and three client.while single pipe for commmunication between processes and server. for synchronisation i&#8217;ve used signal handler.signal(SIGUSR1,ouch). &#8212;&#8211;program for server&#8212;&#8212; RCS file: ./server.c,v Working file: ./server.c head: 1.5 branch: &#8230; <a href="https://www.emblogic.com/blog/07/client-server-communication-using-pipe-and-signal/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>&#8212;in this program i&#8217;ve used the pipe for communication between server and three client.while single pipe for commmunication between processes and server.<br />
for synchronisation i&#8217;ve used signal handler.signal(SIGUSR1,ouch).<br />
&#8212;&#8211;program for server&#8212;&#8212;</p>
<p>RCS file: ./server.c,v<br />
Working file: ./server.c<br />
head: 1.5<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 5;	selected revisions: 5<br />
description:<br />
working for second client<br />
created a pipe an<br />
for communication between server and client2<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2014/07/06 12:05:00;  author: root;  state: Exp;  lines: +110 -57<br />
the server used three pipe for communication between three client<br />
and single pipe for communication between process and server<br />
for sync i&#8217;ve used signal sigusr<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2014/07/05 08:35:03;  author: root;  state: Exp;  lines: +45 -7<br />
make a new pipe for client3<br />
recieve the data from client3 and proceed it to process 3<br />
the process3 use the common pipe for all the three process<br />
for sync i&#8217;ve used sleep<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2014/07/05 04:02:23;  author: root;  state: Exp;  lines: +26 -5<br />
in server for the client_2 i add a pipe between the client2 and server<br />
by using the previous pipe which is between process1 and server<br />
i used data communication between server and process2<br />
to sync i used sleep as per requirement<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/07/04 18:58:33;  author: root;  state: Exp;  lines: +7 -4<br />
creating new pipe for process2<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/07/04 17:21:57;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================<br />
&#8212;&#8212;&#8212;&#8211;program for client&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>RCS file: client1.c,v<br />
Working file: client1.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
	root: 1.1<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;	selected revisions: 1<br />
description:<br />
in client i&#8217;ve used if else condition<br />
in the if condition it compare  with the flag which has sent by server<br />
for client1  i&#8217;ve sent  message &#8220;client1&#8243; to client  when the if condition true then the client<br />
receive the output<br />
in else condition the client write the data to server<br />
for sync i&#8217;ve used signal<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1	locked by: root;<br />
date: 2014/07/06 12:36:43;  author: root;  state: Exp;<br />
Initial revision<br />
============================================================================</p>
<p>***************process&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
RCS file: process1.c,v<br />
Working file: process1.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
	root: 1.1<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;	selected revisions: 1<br />
description:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1	locked by: root;<br />
date: 2014/07/06 13:03:08;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/client-server-communication-using-pipe-and-signal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>client server communication</title>
		<link>https://www.emblogic.com/blog/07/client-server-communication/</link>
		<comments>https://www.emblogic.com/blog/07/client-server-communication/#comments</comments>
		<pubDate>Sat, 05 Jul 2014 08:42:10 +0000</pubDate>
		<dc:creator><![CDATA[Raman Pandey]]></dc:creator>
				<category><![CDATA[Project 03: Client Server Communication using Linux and IPC]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10802</guid>
		<description><![CDATA[for three client&#8212;&#8212; i&#8217;ve used common pipe for processing of data of all the client while i&#8217;ve used three different pipe between each client and server for their respective data communication. &#8212;&#8211;server&#8212;- RCS file: ./server.c,v Working file: ./server.c head: 1.4 &#8230; <a href="https://www.emblogic.com/blog/07/client-server-communication/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>for three client&#8212;&#8212;<br />
i&#8217;ve used common pipe for processing of data of all the client while i&#8217;ve used three different pipe between each client and server for their respective data communication.<br />
&#8212;&#8211;server&#8212;-<br />
RCS file: ./server.c,v<br />
Working file: ./server.c<br />
head: 1.4<br />
branch:<br />
locks: strict<br />
	root: 1.4<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 4;	selected revisions: 4<br />
description:<br />
working for second client<br />
created a pipe an<br />
for communication between server and client2<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4	locked by: root;<br />
date: 2014/07/05 08:35:03;  author: root;  state: Exp;  lines: +45 -7<br />
make a new pipe for client3<br />
recieve the data from client3 and proceed it to process 3<br />
the process3 use the common pipe for all the three process<br />
for sync i&#8217;ve used sleep<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2014/07/05 04:02:23;  author: root;  state: Exp;  lines: +26 -5<br />
in server for the client_2 i add a pipe between the client2 and server<br />
by using the previous pipe which is between process1 and server<br />
i used data communication between server and process2<br />
to sync i used sleep as per requirement<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/07/04 18:58:33;  author: root;  state: Exp;  lines: +7 -4<br />
creating new pipe for process2<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/07/04 17:21:57;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/client-server-communication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>client server communication using pipe</title>
		<link>https://www.emblogic.com/blog/07/client-server-communication-using-pipe/</link>
		<comments>https://www.emblogic.com/blog/07/client-server-communication-using-pipe/#comments</comments>
		<pubDate>Sat, 05 Jul 2014 07:54:23 +0000</pubDate>
		<dc:creator><![CDATA[Raman Pandey]]></dc:creator>
				<category><![CDATA[Project 03: Client Server Communication using Linux and IPC]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10798</guid>
		<description><![CDATA[i&#8217;ve done this program for two client &#8212; inside this program i have to client which need two different action(operation) .the server accept the request of client by using pipe .to perform their desired operation the server again sent this &#8230; <a href="https://www.emblogic.com/blog/07/client-server-communication-using-pipe/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>i&#8217;ve done this program for two client &#8212;<br />
inside this program i have to client which need two different action(operation) .the server accept the request of client by using pipe .to perform their desired operation the server again sent this data to process by using pipe.for both operation i have used single pipe for process1 and process2.after processing the sever request the process1 or process2 wrote the output in pipe which fetched by server.and sever use the respective pipe of client1 and client2  and write this output to client pipe which is then fetched by client.<br />
to manage the sychronisation i&#8217;ve use sleep.we can also used signal for proper sync.<br />
&#8212;&#8212;server&#8230;&#8230;&#8230;.</p>
<p>RCS file: server.c,v<br />
Working file: server.c<br />
head: 1.3<br />
branch:<br />
locks: strict<br />
	root: 1.3<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 3;	selected revisions: 3<br />
description:<br />
working for second client<br />
created a pipe an<br />
for communication between server and client2<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3	locked by: root;<br />
date: 2014/07/05 04:02:23;  author: root;  state: Exp;  lines: +26 -5<br />
in server for the client_2 i add a pipe between the client2 and server<br />
by using the previous pipe which is between process1 and server<br />
i used data communication between server and process2<br />
to sync i used sleep as per requirement<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/07/04 18:58:33;  author: root;  state: Exp;  lines: +7 -4<br />
creating new pipe for process2<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/07/04 17:21:57;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>&#8212;-client&#8212;&#8211;</p>
<p>RCS file: ./client2.c,v<br />
Working file: ./client2.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
	root: 1.1<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;	selected revisions: 1<br />
description:<br />
created a client2.c function<br />
which provides the data to server<br />
by using pipe<br />
and again after processing the data it receive the data from server by using same pipe<br />
for the sync. i used sleep<br />
as per needed<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1	locked by: root;<br />
date: 2014/07/05 04:06:40;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================<br />
&#8212;&#8212;process&#8212;&#8211;</p>
<p>RCS file: ./process2.c,v<br />
Working file: ./process2.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
	root: 1.1<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;	selected revisions: 1<br />
description:<br />
in the process2  i used the same pipe which has been previously used<br />
between process1 and server<br />
in the process i perform the operation as per operator<br />
after performing operation process2 return the result to the server<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1	locked by: root;<br />
date: 2014/07/05 04:08:53;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/client-server-communication-using-pipe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>program to handle orphan process</title>
		<link>https://www.emblogic.com/blog/07/program-to-handle-orphan-process/</link>
		<comments>https://www.emblogic.com/blog/07/program-to-handle-orphan-process/#comments</comments>
		<pubDate>Fri, 04 Jul 2014 13:27:49 +0000</pubDate>
		<dc:creator><![CDATA[Raman Pandey]]></dc:creator>
				<category><![CDATA[Project 03: Client Server Communication using Linux and IPC]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10784</guid>
		<description><![CDATA[when the parent process finish it&#8217;s execution and the child process is not finished then in this case prompt don&#8217;t come normally.the termination goes abnormal then we get the prompt.to resolve this issue we use wait() RCS file: ./orphan_using_wait.c,v Working &#8230; <a href="https://www.emblogic.com/blog/07/program-to-handle-orphan-process/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>when the parent process finish it&#8217;s execution and the child process is not finished then in this case prompt don&#8217;t come normally.the termination goes abnormal then we get the prompt.to resolve this issue we use wait()</p>
<p>RCS file: ./orphan_using_wait.c,v<br />
Working file: ./orphan_using_wait.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
	root: 1.1<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;	selected revisions: 1<br />
description:<br />
when the parent process complete its execution<br />
then the child becomes orphan process<br />
in this case our prompt don&#8217;t came automatically<br />
to handle this we use wait() function<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1	locked by: root;<br />
date: 2014/07/04 13:17:35;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/program-to-handle-orphan-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>program for single server client ipc</title>
		<link>https://www.emblogic.com/blog/07/program-for-single-server-client-ipc/</link>
		<comments>https://www.emblogic.com/blog/07/program-for-single-server-client-ipc/#comments</comments>
		<pubDate>Fri, 04 Jul 2014 12:41:56 +0000</pubDate>
		<dc:creator><![CDATA[Raman Pandey]]></dc:creator>
				<category><![CDATA[Project 03: Client Server Communication using Linux and IPC]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10775</guid>
		<description><![CDATA[program for server: for single server,client and process i have used one pipe for communication between server and client and another one for communication between server and process .as pipe can only used between related process thats why we need &#8230; <a href="https://www.emblogic.com/blog/07/program-for-single-server-client-ipc/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>program for server:<br />
for single server,client and process i have used one pipe for communication between server and client and another one for communication between server and process .as pipe can only used between related process thats why we need two fork() for these functionalities<br />
&#8212;&#8212;-server&#8212;&#8212;&#8212;-</p>
<p>RCS file: server.c,v<br />
Working file: server.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
	root: 1.1<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;	selected revisions: 1<br />
description:<br />
it receive data from client<br />
then read it and further it write the data into process<br />
again it receive the processing data from process program<br />
now sent the output to client by pipe<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1	locked by: root;<br />
date: 2014/07/04 12:22:14;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================<br />
&#8212;&#8212;&#8212;-client&#8212;&#8212;&#8212;&#8212;-</p>
<p>RCS file: server.c,v<br />
Working file: server.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
	root: 1.1<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;	selected revisions: 1<br />
description:<br />
it receive data from client<br />
then read it and further it write the data into process<br />
again it receive the processing data from process program<br />
now sent the output to client by pipe<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1	locked by: root;<br />
date: 2014/07/04 12:22:14;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================<br />
&#8212;&#8212;&#8212;process&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;</p>
<p>RCS file: server.c,v<br />
Working file: server.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
	root: 1.1<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;	selected revisions: 1<br />
description:<br />
it receive data from client<br />
then read it and further it write the data into process<br />
again it receive the processing data from process program<br />
now sent the output to client by pipe<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1	locked by: root;<br />
date: 2014/07/04 12:22:14;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/program-for-single-server-client-ipc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>conversion of lower case character of string to uppercase character of any string</title>
		<link>https://www.emblogic.com/blog/07/conversion-of-lower-case-character-of-string-to-uppercase-character-of-any-string/</link>
		<comments>https://www.emblogic.com/blog/07/conversion-of-lower-case-character-of-string-to-uppercase-character-of-any-string/#comments</comments>
		<pubDate>Tue, 01 Jul 2014 12:57:39 +0000</pubDate>
		<dc:creator><![CDATA[Raman Pandey]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10749</guid>
		<description><![CDATA[RCS file: conversion.c,v Working file: conversion.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 program converts the lowercase or upercase character of string into upercase and &#8230; <a href="https://www.emblogic.com/blog/07/conversion-of-lower-case-character-of-string-to-uppercase-character-of-any-string/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>RCS file: conversion.c,v<br />
Working file: conversion.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
root: 1.1<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
this program converts the lowercase or upercase character of string into upercase and lowercase character respectively<br />
we pass the string through command line<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1    locked by: root;<br />
date: 2014/07/01 12:51:41;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/conversion-of-lower-case-character-of-string-to-uppercase-character-of-any-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>process duplication and using wait function</title>
		<link>https://www.emblogic.com/blog/07/process-duplication-and-using-wait-function/</link>
		<comments>https://www.emblogic.com/blog/07/process-duplication-and-using-wait-function/#comments</comments>
		<pubDate>Tue, 01 Jul 2014 12:47:14 +0000</pubDate>
		<dc:creator><![CDATA[Raman Pandey]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10747</guid>
		<description><![CDATA[RCS file: wait.c,v Working file: wait.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1;    selected revisions: 1 description: implementing the wait() using WIFEXITED() and WEXITSTATUS() &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- revision 1.1    locked by: root; &#8230; <a href="https://www.emblogic.com/blog/07/process-duplication-and-using-wait-function/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>RCS file: wait.c,v<br />
Working file: wait.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
root: 1.1<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
implementing the wait()<br />
using WIFEXITED() and WEXITSTATUS()<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1    locked by: root;<br />
date: 2014/07/01 12:43:08;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/process-duplication-and-using-wait-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>compresion function for 4 bit mdcaeuit</title>
		<link>https://www.emblogic.com/blog/06/compresion-function-for-4-bit-mdcaeuit/</link>
		<comments>https://www.emblogic.com/blog/06/compresion-function-for-4-bit-mdcaeuit/#comments</comments>
		<pubDate>Mon, 09 Jun 2014 06:48:57 +0000</pubDate>
		<dc:creator><![CDATA[Raman Pandey]]></dc:creator>
				<category><![CDATA[Data Structures with C]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10420</guid>
		<description><![CDATA[head    1.47; access; symbols; locks root:1.47; strict; comment    @ * @; 1.47 date    2014.06.08.07.52.37;    author root;    state Exp; branches; next    1.46; 1.46 date    2014.06.07.16.31.29;    author root;    state Exp; branches; next    1.45; 1.45 date    2014.06.07.16.21.15;    author root;    state Exp; branches 1.45.1.1; &#8230; <a href="https://www.emblogic.com/blog/06/compresion-function-for-4-bit-mdcaeuit/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>head    1.47;<br />
access;<br />
symbols;<br />
locks<br />
root:1.47; strict;<br />
comment    @ * @;</p>
<p>1.47<br />
date    2014.06.08.07.52.37;    author root;    state Exp;<br />
branches;<br />
next    1.46;</p>
<p>1.46<br />
date    2014.06.07.16.31.29;    author root;    state Exp;<br />
branches;<br />
next    1.45;</p>
<p>1.45<br />
date    2014.06.07.16.21.15;    author root;    state Exp;<br />
branches<br />
1.45.1.1;<br />
next    1.44;</p>
<p>1.44<br />
date    2014.06.07.16.06.07;    author root;    state Exp;<br />
branches;<br />
next    1.43;</p>
<p>1.43<br />
date    2014.06.07.16.05.31;    author root;    state Exp;<br />
branches;<br />
next    1.42;</p>
<p>1.42<br />
date    2014.06.07.16.04.35;    author root;    state Exp;<br />
branches;<br />
next    1.41;</p>
<p>1.41<br />
date    2014.06.07.16.00.50;    author root;    state Exp;<br />
branches;<br />
next    1.40;</p>
<p>1.40<br />
date    2014.06.07.09.48.05;    author root;    state Exp;<br />
branches;<br />
next    1.39;</p>
<p>1.39<br />
date    2014.06.06.11.25.18;    author root;    state Exp;<br />
branches;<br />
next    1.38;</p>
<p>1.38<br />
date    2014.06.06.11.00.51;    author root;    state Exp;<br />
branches;<br />
next    1.37;</p>
<p>1.37<br />
date    2014.06.06.10.40.07;    author root;    state Exp;<br />
branches;<br />
next    1.36;</p>
<p>1.36<br />
date    2014.06.06.10.36.52;    author root;    state Exp;<br />
branches;<br />
next    1.35;</p>
<p>1.35<br />
date    2014.06.06.07.30.42;    author root;    state Exp;<br />
branches;<br />
next    1.34;</p>
<p>1.34<br />
date    2014.06.06.07.29.14;    author root;    state Exp;<br />
branches;<br />
next    1.33;</p>
<p>1.33<br />
date    2014.06.06.06.32.11;    author root;    state Exp;<br />
branches;<br />
next    1.32;</p>
<p>1.32<br />
date    2014.06.06.06.29.27;    author root;    state Exp;<br />
branches;<br />
next    1.31;</p>
<p>1.31<br />
date    2014.06.06.06.25.43;    author root;    state Exp;<br />
branches;<br />
next    1.30;</p>
<p>1.30<br />
date    2014.06.06.06.25.02;    author root;    state Exp;<br />
branches;<br />
next    1.29;</p>
<p>1.29<br />
date    2014.06.06.06.24.11;    author root;    state Exp;<br />
branches;<br />
next    1.28;</p>
<p>1.28<br />
date    2014.06.06.06.21.01;    author root;    state Exp;<br />
branches;<br />
next    1.27;</p>
<p>1.27<br />
date    2014.06.06.06.18.33;    author root;    state Exp;<br />
branches;<br />
next    1.26;</p>
<p>1.26<br />
date    2014.06.06.06.11.46;    author root;    state Exp;<br />
branches;<br />
next    1.25;</p>
<p>1.25<br />
date    2014.06.06.06.10.41;    author root;    state Exp;<br />
branches;<br />
next    1.24;</p>
<p>1.24<br />
date    2014.06.06.06.08.21;    author root;    state Exp;<br />
branches;<br />
next    1.23;</p>
<p>1.23<br />
date    2014.06.06.06.01.28;    author root;    state Exp;<br />
branches;<br />
next    1.22;</p>
<p>1.22<br />
date    2014.06.06.05.56.12;    author root;    state Exp;<br />
branches;<br />
next    1.21;</p>
<p>1.21<br />
date    2014.06.06.05.55.18;    author root;    state Exp;<br />
branches;<br />
next    1.20;</p>
<p>1.20<br />
date    2014.06.06.05.53.59;    author root;    state Exp;<br />
branches;<br />
next    1.19;</p>
<p>1.19<br />
date    2014.06.06.05.47.16;    author root;    state Exp;<br />
branches;<br />
next    1.18;</p>
<p>1.18<br />
date    2014.06.06.05.41.57;    author root;    state Exp;<br />
branches;<br />
next    1.17;</p>
<p>1.17<br />
date    2014.06.06.05.37.18;    author root;    state Exp;<br />
branches;<br />
next    1.16;</p>
<p>1.16<br />
date    2014.06.03.09.37.34;    author root;    state Exp;<br />
branches;<br />
next    1.15;</p>
<p>1.15<br />
date    2014.06.03.09.32.41;    author root;    state Exp;<br />
branches;<br />
next    1.14;</p>
<p>1.14<br />
date    2014.06.03.09.32.10;    author root;    state Exp;<br />
branches;<br />
next    1.13;</p>
<p>1.13<br />
date    2014.06.03.09.01.19;    author root;    state Exp;<br />
branches;<br />
next    1.12;</p>
<p>1.12<br />
date    2014.06.03.09.00.33;    author root;    state Exp;<br />
branches;<br />
next    1.11;</p>
<p>1.11<br />
date    2014.06.03.08.57.27;    author root;    state Exp;<br />
branches;<br />
next    1.10;</p>
<p>1.10<br />
date    2014.06.03.08.55.36;    author root;    state Exp;<br />
branches;<br />
next    1.9;</p>
<p>1.9<br />
date    2014.06.03.08.54.19;    author root;    state Exp;<br />
branches;<br />
next    1.8;</p>
<p>1.8<br />
date    2014.06.03.08.53.22;    author root;    state Exp;<br />
branches;<br />
next    1.7;</p>
<p>1.7<br />
date    2014.06.03.08.52.23;    author root;    state Exp;<br />
branches;<br />
next    1.6;</p>
<p>1.6<br />
date    2014.06.03.08.51.19;    author root;    state Exp;<br />
branches;<br />
next    1.5;</p>
<p>1.5<br />
date    2014.06.03.08.48.55;    author raman;    state Exp;<br />
branches;<br />
next    1.4;</p>
<p>1.4<br />
date    2014.06.03.08.47.22;    author raman;    state Exp;<br />
branches;<br />
next    1.3;</p>
<p>1.3<br />
date    2014.06.03.08.45.30;    author raman;    state Exp;<br />
branches;<br />
next    1.2;</p>
<p>1.2<br />
date    2014.06.03.08.39.27;    author raman;    state Exp;<br />
branches;<br />
next    1.1;</p>
<p>1.1<br />
date    2014.06.03.07.13.37;    author raman;    state Exp;<br />
branches;<br />
next    ;</p>
<p>1.45.1.1<br />
date    2014.06.08.08.12.17;    author root;    state Exp;<br />
branches;<br />
next    ;</p>
<p>desc<br />
@creation of main funcion and open_file<br />
@</p>
<p>1.47<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@#include&#8221;header.h&#8221;<br />
int open_file(char *filename)<br />
{<br />
int fd;<br />
fd=open(filename,O_RDONLY);<br />
if(fd&lt;0)<br />
{    perror(&#8220;file not open&#8221;);<br />
goto out;<br />
}<br />
return fd;<br />
out:<br />
return -1;<br />
}<br />
char *masterarray(int fd)<br />
{<br />
int i=0,nread;<br />
char *masterarr;<br />
char ch;<br />
masterarr=(char *)malloc(sizeof(char));<br />
while(1)<br />
{<br />
int j=0,flag=0;<br />
nread=read(fd,&amp;ch,1);<br />
//    printf(&#8220;%c\n&#8221;,ch);</p>
<p>if(ch==10)<br />
break;<br />
//    *(masterarr+j)=ch;<br />
//    masterarr=(char *)realloc(masterarr,1+i);</p>
<p>for(j=0;j&lt;i;j++)<br />
{<br />
if(*(masterarr+j)==ch)<br />
{<br />
flag=1;<br />
}<br />
}<br />
if(flag==0)<br />
{<br />
*(masterarr+i)=ch;<br />
masterarr=realloc(masterarr,1+i);<br />
i++;<br />
}<br />
flag=0;</p>
<p>}<br />
printf(&#8220;\n masterarray is :%s&#8221;,masterarr);<br />
return masterarr;</p>
<p>}<br />
compression(char *p,int fd)<br />
{<br />
printf(&#8220;\n string is :%s&#8221;,p);<br />
unsigned char ch,byt,byt1;<br />
unsigned int loc=0;<br />
int  count=0,nread,nwrite,i=0,j,fdw,count1=0,count2=0;<br />
int no_of_char;<br />
no_of_char=lseek(fd,0,SEEK_END);<br />
printf(&#8220;\n no. of character is :%d&#8221;,no_of_char);<br />
lseek(fd,0,SEEK_SET);<br />
fdw=open(&#8220;comprsd_file&#8221;,O_RDWR |O_CREAT);<br />
printf(&#8220;\n fdw=%d&#8221;,fdw);<br />
while(1)<br />
{<br />
nread=read(fd,&amp;ch,1);<br />
//    printf(&#8220;%c&#8221;,ch);<br />
i=0;<br />
if(ch==10)<br />
break;<br />
for(i=0;*(p+i)!=ch;i++)<br />
{</p>
<p>}<br />
loc=i;<br />
printf(&#8220;\n loc %d :%d&#8221;,count2,loc);<br />
count2++;<br />
// sprintf(&amp;byt,&#8221;%d&#8221;,loc);<br />
byt=loc;<br />
if(count==0)<br />
{<br />
byt1=byt;<br />
byt1&lt;&lt;=4;<br />
count++;</p>
<p>}<br />
else<br />
{<br />
byt&lt;&lt;=4;<br />
byt&gt;&gt;=4;<br />
byt=byt1|byt;<br />
count=0;<br />
nwrite=write(fdw,&amp;byt,1);<br />
printf(&#8220;\t char written :%c&#8221;,byt);<br />
count1++;<br />
byt^=byt;<br />
byt1^=byt1;<br />
}</p>
<p>}<br />
close(fdw);<br />
fdw=open(&#8220;encryption_key&#8221;,O_RDWR |O_CREAT);<br />
nwrite=write(fdw,p,strlen(p));<br />
printf(&#8220;\nno. of bytes write :%d&#8221;,count1);<br />
return 0;<br />
}<br />
int main(int argc,char *argv[])<br />
{<br />
int fd;<br />
char *masterarr;<br />
masterarr=(char *)malloc(sizeof(char));<br />
if(argc!=2)<br />
{<br />
printf(&#8220;argument error&#8221;);<br />
goto out;<br />
}<br />
fd=open_file(argv[1]);<br />
printf(&#8220;fd=%d&#8221;,fd);<br />
masterarr=masterarray(fd);<br />
printf(&#8220;length :%d&#8221;,strlen(masterarr));<br />
compression(masterarr,fd);<br />
//    printf(&#8220;\n masterarray is :%s \n&#8221;,masterarr);<br />
return 0;<br />
out:<br />
return -1;<br />
}<br />
@</p>
<p>1.46<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d79 1<br />
a79 6<br />
if(count2%2!=0 &amp;&amp; count2==no_of_char-1 &amp;&amp; count==0)<br />
{</p>
<p>write(fdw,&amp;byt,1);<br />
}<br />
else if(count==0)<br />
@</p>
<p>1.45<br />
log<br />
@to remove the problem of last character .<br />
if the no. of char is odd<br />
then put the last character in byte and write it<br />
@<br />
text<br />
@d79 1<br />
a79 1<br />
if(count2%2==0 &amp;&amp; count2==no_of_char-1 &amp;&amp; count==0)<br />
@</p>
<p>1.45.1.1<br />
log<br />
@work for the last character<br />
when no. of character is odd<br />
@<br />
text<br />
@d79 6<br />
a84 1<br />
if(count==0)<br />
@</p>
<p>1.44<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d55 1<br />
a55 1<br />
unsigned loc=0;<br />
d79 6<br />
a84 1<br />
if(count==0)<br />
@</p>
<p>1.43<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d57 1<br />
a57 1<br />
int no_of _char;<br />
@</p>
<p>1.42<br />
log<br />
@corecting the error<br />
@<br />
text<br />
@d57 2<br />
a58 1<br />
int no_of _char=lseek(fd,0,SEEK_END);<br />
@</p>
<p>1.41<br />
log<br />
@checking the number of character.is it even or odd<br />
@<br />
text<br />
@d56 1<br />
a56 1<br />
int  count=0,nread,nwrite,i=0,j,fdw,count1=0,count2=0;i<br />
@</p>
<p>1.40<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d56 3<br />
a58 1<br />
int  count=0,nread,nwrite,i=0,j,fdw,count1=0,count2=0;<br />
@</p>
<p>1.39<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d116 1<br />
@</p>
<p>1.38<br />
log<br />
@checking encrypted code<br />
@<br />
text<br />
@d74 2<br />
a75 1<br />
sprintf(&amp;byt,&#8221;%d&#8221;,loc);<br />
@</p>
<p>1.37<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d89 1<br />
@</p>
<p>1.36<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d55 2<br />
a56 1<br />
int  count=0,nread,nwrite,i=0,j,fdw,loc=0,count1=0,count2=0;<br />
@</p>
<p>1.35<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d55 1<br />
a55 1<br />
int  count=0,nread,nwrite,i=0,j,fdw,loc=0,count1=0;<br />
d71 2<br />
a72 1<br />
printf(&#8220;\n loc :%d&#8221;,loc);<br />
@</p>
<p>1.34<br />
log<br />
@creating encryption_key file<br />
@<br />
text<br />
@d95 1<br />
a95 1<br />
nwrite=write(fdw,masterarr,strlen(masterarr));<br />
@</p>
<p>1.33<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d93 3<br />
@</p>
<p>1.32<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@a67 1<br />
loc=i;<br />
d70 1<br />
@</p>
<p>1.31<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d55 1<br />
a55 1<br />
int  count=0,nread,nwrite,i=0,j,fdw,loc,count1=0;<br />
@</p>
<p>1.30<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d69 1<br />
a69 1<br />
break;<br />
@</p>
<p>1.29<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d66 1<br />
a66 1<br />
for(i=0;*(p+i)==ch;i++)<br />
@</p>
<p>1.28<br />
log<br />
@checking location<br />
@<br />
text<br />
@d69 1<br />
a69 1</p>
<p>@</p>
<p>1.27<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d71 1<br />
a71 1</p>
<p>@</p>
<p>1.26<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d77 1<br />
d80 1<br />
a80 1<br />
if(count==1)<br />
d91 1<br />
a91 1<br />
count++;<br />
@</p>
<p>1.25<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d77 1<br />
a77 1<br />
count++;<br />
d90 1<br />
@</p>
<p>1.24<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d86 1<br />
a86 1</p>
<p>d91 1<br />
@</p>
<p>1.23<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d55 1<br />
a55 1<br />
int  count=0,nread,nwrite,i=0,j,fdw,loc;<br />
d71 1<br />
d79 1<br />
a79 1<br />
if(count=1)<br />
d86 1<br />
@</p>
<p>1.22<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d66 1<br />
a66 1<br />
while(p[i]==ch)<br />
d69 1<br />
a69 1<br />
i++;<br />
@</p>
<p>1.21<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d62 2<br />
a63 1<br />
printf(&#8220;%c&#8221;,ch);<br />
@</p>
<p>1.20<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d62 1<br />
@</p>
<p>1.19<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d53 1<br />
d58 1<br />
@</p>
<p>1.18<br />
log<br />
@resolve error msg<br />
@<br />
text<br />
@d59 25<br />
a83 25</p>
<p>nread=read(fd,&amp;ch,1);<br />
if(ch==10)<br />
break;<br />
while(p[i]==ch)<br />
{<br />
loc=i;<br />
i++;<br />
}<br />
sprintf(&amp;byt,&#8221;%d&#8221;,loc);<br />
if(count==0)<br />
{<br />
byt1=byt;<br />
byt1&lt;&lt;=4;<br />
count++;<br />
}<br />
if(count=1)<br />
{<br />
byt&lt;&lt;=4;<br />
byt&gt;&gt;=4;<br />
byt=byt1|byt;<br />
count=0;<br />
nwrite=write(fdw,&amp;byt,1);<br />
byt^=byt;<br />
byt1^=byt1;<br />
@</p>
<p>1.17<br />
log<br />
@creating the compressed file using compress function<br />
the comprsd_file contain the encryted data<br />
@<br />
text<br />
@d54 1<br />
a54 1<br />
int  count=0,nread,nwrite,i=0,j,fdw;<br />
d97 1<br />
a97 1<br />
fd=open_file(argerav[1]);<br />
@</p>
<p>1.16<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d51 36<br />
d97 1<br />
a97 1<br />
fd=open_file(argv[1]);<br />
d100 1<br />
@</p>
<p>1.15<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d28 2<br />
a29 2<br />
*(masterarr+i)=ch;<br />
masterarr=(char *)realloc(masterarr,1+i);<br />
d41 2<br />
d44 2<br />
a45 1<br />
i++;<br />
@</p>
<p>1.14<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d22 1<br />
a22 1<br />
int j=0;flag=0;<br />
@</p>
<p>1.13<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d22 1<br />
d30 12<br />
d44 1<br />
a44 1<br />
//    printf(&#8220;\n masterarray is :%s&#8221;,masterarr);<br />
d61 1<br />
a61 1<br />
printf(&#8220;\n masterarray is :%s \n&#8221;,masterarr);<br />
@</p>
<p>1.12<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d48 1<br />
a48 1<br />
printf(&#8220;\n masterarray is %s :&#8221;,masterarr);<br />
@</p>
<p>1.11<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d31 1<br />
a31 1<br />
printf(&#8220;\n masterarray is :%s&#8221;,masterarr);<br />
d48 1<br />
@</p>
<p>1.10<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d26 1<br />
a26 1<br />
goto out;<br />
d33 1<br />
a33 2<br />
out:<br />
return -1;<br />
@</p>
<p>1.9<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d20 1<br />
a20 1<br />
while(nread)<br />
@</p>
<p>1.8<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d25 2<br />
a26 2<br />
//if(ch==10)<br />
//goto out;<br />
@</p>
<p>1.7<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d27 1<br />
a27 1<br />
*masterarr=ch;<br />
@</p>
<p>1.6<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d23 1<br />
a23 1<br />
printf(&#8220;%c\n&#8221;,ch);<br />
@</p>
<p>1.5<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d16 1<br />
a16 1<br />
int i=0;<br />
d20 1<br />
a20 1<br />
while(1)<br />
d22 1<br />
a22 1<br />
read(fd,&amp;ch,1);<br />
@</p>
<p>1.4<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d25 2<br />
a26 2<br />
if(ch==10)<br />
goto out;<br />
@</p>
<p>1.3<br />
log<br />
@*** empty log message ***<br />
@<br />
text<br />
@d23 2<br />
@</p>
<p>1.2<br />
log<br />
@definition of masterarray()<br />
@<br />
text<br />
@d17 1<br />
a17 1<br />
char *p;<br />
d19 1<br />
a19 1<br />
p=(char *)malloc(sizeof(char));<br />
d24 1<br />
a24 1<br />
goto out;<br />
d30 1<br />
a30 1<br />
return 0;<br />
@</p>
<p>1.1<br />
log<br />
@Initial revision<br />
@<br />
text<br />
@d14 20<br />
a33 1</p>
<p>d37 2<br />
d46 1<br />
a46 1</p>
<p>@</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/06/compresion-function-for-4-bit-mdcaeuit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
