© 2012 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies
« NS2  Projects »

Home Lab Exercise Network Lab Exercise Programs Implementation Of Bit Stuffing▼


Implementation of Bit Stuffing:

Algorithm Steps:

Step1: Start the program.

Step 2: Include all the header files.

Step 3: Declare two files pointers for opening the input file in read mode and the output in write mode.

Step 4: Read the content of an input file.

Step 5: If the bit is 1, then check for four consecutive 1,s.

Step 6: If so then stuff a bit 0 at that position (i.e. after five consecutive 1’s)

Step 7: open the output file in write mode and print the stuffed string.

Step 8: Stop the program.

C Program To Implement Bit Stuffing

#include #include main() { int i=0,j=0,k,d; char a[50]; do { printf("\n enter the choice 1.stuff 2.destuff 3.exit"); scanf("%d".&d); switch(d) { case 1: printf("enter the data.."); scanf("%s",a); for(i=0<;ii;k--) { a[k+1]=a[k]; } a[i+1]='0'; } } printf(%s",a); break; case 2: printf("\n enter the data"); scanf("%s",a); j=0; for(i=0;i

SAMPLE INPUT OUTPUT:

"bit.c"60L, 644C written
[csea56@localhost csea56]$ cc bit.c
[csea56@localhost csea56]$ ./a.out

enter the choise 1.stuff 2.destuff 3.exit1
enter the data..10111111010
10111111010
enter the choice 1.stuff 2.destuff 3.exit2
enter the data 10111111010

the unstuffed data is 10111111010
enter the choice 1.stuff 2.destuff 3.exit

 
SLogix Student Projects

⇓ Student Projects ⇓
⇑ Student Projects ⇑
bottom