EmbLogic's Blog

RCS file: 6th_q_4.c,v
Working file: 6th_q_4.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
add inches and feets of two distances.
—————————-
revision 1.1 locked by: root;
date: 2014/07/18 12:21:11; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

RCS file: 5th_q_4.c,v
Working file: 5th_q_4.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
check colour codes with type of colour.
—————————-
revision 1.1 locked by: root;
date: 2014/07/18 12:21:11; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

RCS file: 4th_q_4.c,v
Working file: 4th_q_4.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
coverter inches to centimeters.
—————————-
revision 1.1 locked by: root;
date: 2014/07/18 12:21:11; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

RCS file: 3rd_q_4.c,v
Working file: 3rd_q_4.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
check the test compitions score with grade.
—————————-
revision 1.1 locked by: root;
date: 2014/07/18 12:21:11; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

RCS file: 2nd_q_4.c,v
Working file: 2nd_q_4.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
enter multiple numbers from user then print largest smallest number.
—————————-
revision 1.1 locked by: root;
date: 2014/07/18 12:21:11; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

RCS file: 1st_q_4.c,v Working file: 1st_q_4.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: check the entered number by the user is positive or negative. —————————- revision 1.1 locked by: root; date: 2014/07/18 12:21:11; author: root; state: Exp; Initial revision =============================================================================

Posted in Uncategorized | Leave a comment

c program to find master array using rcs

I have created master array successfully.

Posted in Data Structures with C | Leave a comment

master array using function

1
2 RCS file: header.h,v
3 Working file: header.h
4 head: 1.1
5 branch:
6 locks: strict
7 access list:
8 symbolic names:
9 keyword substitution: kv
10 total revisions: 1;     selected revisions: 1
11 description:
12 include all header files
13 —————————-
14 revision 1.1
15 date: 2014/07/17 20:53:59;  author: root;  state: Exp;
16 Initial revision
17 =============================================================================

1
2 RCS file: ma.c,v
3 Working file: ma.c
4 head: 1.16
5 branch:
6 locks: strict
7 access list:
8 symbolic names:
9 keyword substitution: kv
10 total revisions: 16;    selected revisions: 16
11 description:
12 make open function
13 —————————-
14 revision 1.16
15 date: 2014/07/17 22:57:47;  author: root;  state: Exp;  lines: +2 -2
16 remove all printf which is no needed
17 —————————-
18 revision 1.15
19 date: 2014/07/17 22:55:54;  author: root;  state: Exp;  lines: +6 -5
20 put \n
21 return the value of ma
22 —————————-
23 revision 1.14
24 date: 2014/07/17 22:50:26;  author: root;  state: Exp;  lines: +4 -7
25 solve the error that i return fd but dont catch it while calling that function
26 —————————-
27 revision 1.13
28 date: 2014/07/17 22:28:42;  author: root;  state: Exp;  lines: +8 -7
29 *** empty log message ***
30 —————————-
31 revision 1.12
32 date: 2014/07/17 21:53:59;  author: root;  state: Exp;  lines: +1 -1
33 *** empty log message ***
34 —————————-
35 revision 1.11
36 date: 2014/07/17 21:46:07;  author: root;  state: Exp;  lines: +1 -1
37 *** empty log message ***
38 —————————-
39 revision 1.10
40 date: 2014/07/17 21:44:51;  author: root;  state: Exp;  lines: +1 -1
41 *** empty log message ***
42 —————————-
43 revision 1.9
44 date: 2014/07/17 21:39:41;  author: root;  state: Exp;  lines: +1 -1
45 *** empty log message ***
46 —————————-
47 revision 1.8
48 date: 2014/07/17 21:36:23;  author: root;  state: Exp;  lines: +1 -1
49 *** empty log message ***
50 —————————-
51 revision 1.7
52 date: 2014/07/17 21:35:46;  author: root;  state: Exp;  lines: +1 -1
53 *** empty log message ***
54 —————————-
55 revision 1.6
56 date: 2014/07/17 21:34:56;  author: root;  state: Exp;  lines: +1 -1
57 *** empty log message ***
58 —————————-
59 revision 1.5
60 date: 2014/07/17 21:34:09;  author: root;  state: Exp;  lines: +1 -1
61 *** empty log message ***
62 —————————-
63 revision 1.4
64 date: 2014/07/17 21:33:19;  author: root;  state: Exp;  lines: +1 -1
65 *** empty log message ***
66 —————————-
67 revision 1.3
68 date: 2014/07/17 21:31:06;  author: root;  state: Exp;  lines: +44 -1
69 making a function of master array
70 —————————-
71 revision 1.2
72 date: 2014/07/17 20:57:32;  author: root;  state: Exp;  lines: +1 -1
73 remove the a[] and directly inserting the string
74 —————————-
75 revision 1.1
76 date: 2014/07/17 20:53:59;  author: root;  state: Exp;
77 Initial revision
78 =============================================================================:wq

Posted in Uncategorized | Leave a comment

Problem in setting file permissions from open. Want help.

I want to give the permissions of 0666 to my file. But due to the masking done by the umask, I am unable to set the desired file permissions.

If anybody have solutions, I would be thankful.

Posted in Uncategorized | Leave a comment

Master Array Using Function With RCS

2 RCS file: file.c,v
3 Working file: file.c
4 head: 1.3
5 branch:
6 locks: strict
7 access list:
8 symbolic names:
9 keyword substitution: kv
10 total revisions: 3;     selected revisions: 3
11 description:
12 This is main Program file for the Multiple Data Compression(MDC)
13 in which i use file_open function for read the file
14 and master_array function are used for to create master array
15 —————————-
16 revision 1.3
17 date: 2014/07/09 22:12:30;  author: root;  state: Exp;  lines: +1 -1
18 error are removed by using adding ‘;’
19 —————————-
20 revision 1.2
21 date: 2014/07/09 22:11:41;  author: root;  state: Exp;  lines: +1 -1
22 some changes are done
23 —————————-
24 revision 1.1
25 date: 2014/07/09 22:00:46;  author: root;  state: Exp;
26 Initial revision
27 =============================================================================
~
~

Header file Log>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

2 RCS file: header.h,v
3 Working file: header.h
4 head: 1.1
5 branch:
6 locks: strict
7 access list:
8 symbolic names:
9 keyword substitution: kv
10 total revisions: 1;     selected revisions: 1
11 description:
12 it is the source of the Header File In which we include
13 stdio.h
14 stdlib.h
15 fcntl.h
16 —————————-
17 revision 1.1
18 date: 2014/07/09 22:07:17;  author: root;  state: Exp;
19 Initial revision
20 =============================================================================
~
~

Master array Created……………………………………………

Posted in Uncategorized | Leave a comment

Master Array

#include”header.h”

int my_open(char*);
char* m_array(int);

int main(int argc,char*argv[])
{
int fd;
char *ma;
fd=my_open(argv[1]);
ma=m_array(fd);
printf(“the master array is %s”,ma);

}
int my_open(char*name)
{
int fd;
fd=open(name,O_RDONLY);
if(fd<0)
{
perror(“open”);
exit(-1);
}
printf(“file opened successfully with fd=%d”,fd);
return fd;
}
char*m_array(int fd)
{
char *ma;
char ch;
int count;
int flag=1;
int i=0;
int k;
ma=malloc(1);
read(fd,&ch,1);
*ma=ch;
while(read(fd,&ch,1))
{
flag=1;
for(k=0;k<=i;k++)
if(ch==ma[k])
{
flag=0;
break;
}
if(flag==1)
{
ma=realloc(ma,i+2);
ma[i+1]=ch;
i++;
}
}
return ma;

Posted in Uncategorized | Leave a comment

rlog / master array

RCS file: marray.c,v
Working file: marray.c
head: 1.10
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 10; selected revisions: 10
description:
this the program for master array
—————————-
revision 1.10
date: 2014/07/18 08:53:24; author: root; state: Exp; lines: +4 -3
some changes
—————————-
revision 1.9
date: 2014/07/18 08:38:51; author: root; state: Exp; lines: +2 -1
flag updated
—————————-
revision 1.8
date: 2014/07/18 08:31:12; author: root; state: Exp; lines: +1 -1
changes
—————————-
revision 1.7
date: 2014/07/18 08:29:33; author: root; state: Exp; lines: +1 -1
changes
—————————-
revision 1.6
date: 2014/07/18 08:27:47; author: root; state: Exp; lines: +33 -13
master array function created
—————————-
revision 1.5
date: 2014/07/18 06:56:37; author: root; state: Exp; lines: +25 -4
prototype for master array created
—————————-
revision 1.4
date: 2014/07/18 06:29:57; author: root; state: Exp; lines: +1 -1
changes
—————————-
revision 1.3
date: 2014/07/18 06:27:15; author: root; state: Exp; lines: +1 -1
semicolon added
—————————-
revision 1.2
date: 2016/07/18 06:24:47; author: root; state: Exp; lines: +26 -2
my_open funtion created to open the “file”
—————————-
revision 1.1
date: 2014/07/18 05:51:56; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

program for stack using link list

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 1.2;

1.2
date 2014.07.16.13.48.56; author root; state Exp;
branches;
next 1.1;

1.1
date 2014.07.16.13.04.04; author root; state Exp;
branches;
next ;

desc
@created main menu and give the choice
declare structure in which one data is info and another is next pointer
of structure type
set the top pointr to -1
@

1.5
log
@*** empty log message ***
@
text
@#include
#include
static int top=-1;
int size;
struct link
{
int info;
struct link *next;
};
struct link *create_node()
{
struct link *temp;
top++;
temp=(struct link *)malloc(sizeof(struct link));
printf(“please enter data :\n”);
scanf(“%d”,&temp->info);

temp->next=NULL;
return temp;

}
struct link *push(struct link *temp)
{
struct link *push=temp;

while(push->next!=NULL)
{
push=push->next;
}
push->next=create_node();
push=push->next;

}
pop(struct link *temp)
{
struct link *temp1=temp->next;
/*while(temp1)
{
temp->info=temp1->info;
if(temp1->next==NULL)
{

temp->next=NULL;
free(temp1);
break;

}
else
{ temp=temp1;
temp1=temp->next;
} }
// temp=NULL;*/
while(temp->next)
{
temp1=temp->next;
if(temp1->next==NULL)
{
temp->next=NULL;
free(temp1);
break;
}
temp=temp->next;

}
top–;
}

display(struct link *disp)
{
printf(“\n stack is :\n”);
while(disp)
{
printf(“%d \n”,disp->info);
disp=disp->next;
}

}
getchoice(int choice)
{
static int flag=0;
static struct link *start,*new;
switch(choice)
{
case 1:
if(top==-1 )
{
start=new=create_node();
flag=1;
}
else
printf(“push the data stack is already created\n”);
break;

case 2:if(top<size-1 && flag)
{
push(new);
}
else if(top-1)
pop(start);
else
printf(“stack is empty\n”);
break;
case 4:
if(top>-1)
display(start);
else
printf(“create stack first \n”);
break;
case 0:
exit(0);
break;
default:
printf(“enter right choice !!\n”);
}
return 0;
}

int main()
{
int choice;
printf(“enter the size of stack \n”);
scanf(“%d”,&size);
while(1)
{
printf(“____MAIN MENU___\n”);
printf(“____1.CREATE STACK__\n”);
printf(“____2.PUSH _____\n”);
printf(“____3.POP _____\n”);
printf(“____4.DISPLAY ____\n”);
printf(“____0.EXIT _____\n”);
printf(“enter choice :\n”);
scanf(“%d”,&choice);
getchoice(choice);
}
return 0;
}
@

1.4
log
@remove error
@
text
@d15 2
a16 1

a24 9
int flag=0;
if(top==0&& !flag)
{
printf(“enter data :\n”);
scanf(“%d”,&push->info);
flag=1;
}
else
{
d26 1
a26 1
while(push)
d31 1
d33 32
a64 2
printf(“enter data :\n”);
scanf(“%d”,&push->next->info);
d66 12
a77 1

d81 2
a82 2
int flag=0;
struct link *start,*new;
d86 1
a86 1
if(top==-1 && !flag)
d91 2
d96 1
d98 3
d102 1
a102 1
printf(“stack is full or stack create first\n”);
d105 10
d133 1
a133 1
printf(“____1.CREATE STACK__”);
@

1.3
log
@declear size
@
text
@d27 1
a27 1
printf(“enter data :\n”)
d40 1
a40 1
printf(“enter data :\n”)
@

1.2
log
@making the getchoice function and then creat_node function
create node funtion create the data space
and then push fucntion write the data in created space
@
text
@d4 1
a4 1
int stack_size;
d79 1
a79 1
scanf(“%d”,&stack_size);
@

1.1
log
@Initial revision
@
text
@d10 64
a73 1

d83 4
a86 3
printf(“____1.PUSH _____\n”);
printf(“____2.POP _____\n”);
printf(“____3.DISPLAY ____\n”);
d90 1
@

Posted in Uncategorized | Leave a comment

program for creating the master array including RCS

1)SOURCE CODE:

#include”header.h”
int f_open(char *);
char *master_arr(int,char*,char *);
int main(int argc,char *argv[])
{
int f,i=0,k=1,j;
char *buff,*ma,c,*mad;
buff=malloc(2);
ma=malloc(1);
f=f_open(argv[1]);
if(f<0)
{
perror(“open”);
exit(EXIT_FAILURE);
}
mad=master_arr(f,buff,ma);
printf(“\nMASTERARRAY:\n%s”,mad);
return 0;
}

int f_open(char *arg)
{
int fd;
fd=open(arg,O_RDONLY);
return fd;
}

char *master_arr(int ff,char *buff,char *ma)
{int i=0,k=1,j;
read(ff,buff,1);
ma[0]=buff[0];
printf(“ma[0] is %c”,ma[0]);

while(read(ff,buff+1+i,1))
{
for(j=0;j<=i;j++)
{ if(ma[j]==buff[i+1])
{
goto x;

}
}

{
ma=realloc(ma,k+1);
ma[k]=buff[i+1];
k++;
}

x:

buff=realloc(buff,i+3);
i++;
}
buff[i]=”;
return ma;

}

2)RCS scripts

#! /bin/bash

ci prog.c
ci header.h

co prog.c,v
co header.h,v

gcc prog.c
./a.out $1

Posted in Data Structures with C | Leave a comment

stack operations using link list (pass by reference)

main

#include”header.h”
int main()
{
int choice;
struct node *start;
start = (struct node *)malloc(sizeof(struct node));
start->next = NULL;
start->prev = NULL;
while(1)
{    choice = get_choice();
operation(choice,&start);
}
return 0;

}

 

FUNCTIONS DEFINITIONS

#include”header.h”
struct node *top=NULL;

int flag=0,count=0;
int get_choice()                                            //getchoice from user
{
int choice;
printf(“\n————STACK MENU————”);
printf(“\n 1. CREATE NODE”);
printf(“\n 2. PUSH”);
printf(“\n 3. POP”);
printf(“\n 4. DISPLAY”);
printf(“\n 0. EXIT”);
printf(“\n\n ENTER TOUR CHOICE\n”);
scanf(” %d”,&choice);
return choice;
}

int operation(int choice, struct node **start)                                //operations
{
switch(choice)
{    case 1 : create_node(start);
break;
case 2 : push(start);
break;
case 3 : pop(start);
break;
case 4 : display(start);
break;
case 0 : exit(0);
break;
default : printf(“\nENTER VALID OPTION”);
}

}

int create_node(struct node **start)                                    //create first node(first PUSH)
{

if(flag)
{    printf(“\n The Stack is already created.”);
}
if(flag==0)
{
struct node * new;
new=(struct node*)malloc(sizeof(struct node));
new->next=NULL;
new->prev = (*start);
(*start)->next = new;
top = new;
printf(“\nEnter the element in the node\n”);
scanf(“%d”,&(new-> info));
flag=1;
printf(“\nFirst element is pushed sucessfully”);
count=1;

}

}

int push(struct node **start)                                        //PUSH
{
if(count<10)
{    struct node *new;
new=(struct node *)malloc(sizeof(struct node));
new->next=NULL;
new->prev=top;
top->next=new;
top=top->next;
printf(“\nEnter the value of node\n”);
scanf(“%d”,&(top->info));
count++;
printf(“\n\nElement pushed successfully”);
}
else
{printf(“\nThe Stack is FULL..”);}

}

int pop(struct node **start)                                        //POP
{
int num;
if(top==(*start))
printf(“The Stack is Empty!!!”);
else
{
num=top->info;
top=top->prev;
top->next->prev=NULL;
top->next=NULL;
count–;
printf(“\nThe element popped is %d”,num);
}

}

int display(struct node **start)                                    //display
{
if(count==0)
printf(“\nThe Stack is empty”);
else
{    struct node *temp;
temp=top;
printf(“\nThe stack is –>”);
while(temp!=(*start))
{
printf(“->  %d”,temp->info);
temp=temp->prev;
}

}
}

Posted in Data Structures with C | Leave a comment