Program for character stuffing

INPUT:
enter string:
asdlefgh
enter position: 8
invalid position,enter again: 3
enter the character: k

OUTPUT:
frame after stuffing:
dlestx as dle k dle dle dlefgh dleetx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<process.h>
void main()
{
int i=0,j=0,n,pos;
char a[20],b[50],ch;
clrscr();
printf("enter string\n");
scanf("%s",&a);
n=strlen(a);
printf("enter position\n");
scanf("%d",&pos);
if(pos>n)
{
printf("invalid position, Enter again :");
scanf("%d",&pos);
}
printf("enter the character\n");
ch=getche();
 
b[0]='d';
b[1]='l';
b[2]='e';
b[3]='s';
b[4]='t';
b[5]='x';
j=6;
while(i<n)
{
if(i==pos-1)
{
b[j]='d';
b[j+1]='l';
b[j+2]='e';
b[j+3]=ch;
b[j+4]='d';
b[j+5]='l';
b[j+6]='e';
j=j+7;
}
if(a[i]=='d' && a[i+1]=='l' && a[i+2]=='e')
{
b[j]='d';
b[j+1]='l';
b[j+2]='e';
j=j+3;
}
 
b[j]=a[i];
i++;
j++;
}
b[j]='d';
b[j+1]='l';
b[j+2]='e';
b[j+3]='e';
b[j+4]='t';
b[j+5]='x';
b[j+6]='\0';
printf("\nframe after stuffing:\n");
printf("%s",b);
getch();
}

24 Responses to “Program for character stuffing”

  1. good code.Easy to understand.

    Can you please send the program for bit stuffing and character stuffing
    program in java using client-server communication ie if client is stuffing
    the bit(as it is sender) then server will un stuff that bits (as it is receiver)
    (plz send soon)

    Reply
  2. There is such good and easy codding for understanding…
    But, why we used “d, l, & e” characters for this codding..?..
    Can we codding this program without that characters..?

    Reply
  3. Plz send the program bit stuffing and character stuffing in java to my mail

    Reply
    • Lavinia

      sya mey usia 21 thun, knp akhir2 ini haid sya sllu sja telat, n kemarin sya haid dn muntah, dbwa aktiftas mw pingsan. trus, pinggang sya sbelah kanan skit terus, n simpisis sbelah kanan sya tersa nyeri jga,, yang sya taxkn apakh itu bnar2 kista? n apkah bisa dcegah karna ni baru prtma kalix merasakn sperti in..dan karna ap kista itu trjadi..sya takut karna tman sya jga sperti sy0#28&3a;..

      Reply
  4. ashita garg

    plz send the program of bit and character stuffing to my mail..plzz

    Reply
    • I should really have paramedics on standby when I open this blog!!! CRIPES…they're ALL gon&9ous….Carg#3e;t wait, can't wait, can't wait to play!Thank you so much ladies for the goreous, nearly heart stopping, inspiration!

      Reply
  5. chandana

    please send me bit unstuffing and character unstuffing programs in c

    Reply
  6. Can you please send the program for character stuffing
    program in java using client-server communication ie if client is stuffing
    the bit(as it is sender) then server will un stuff that bits (as it is receiver)
    (plz send soon)

    Reply
  7. #include
    main()
    {
    int i=2, j=3;
    while(i+1 ? –i : –j)
    {
    printf(“i : %d\n”,i);
    }
    }

    explain this code

    Reply
  8. plz send me output of this code ,,,,i am unable to get output for the code

    Reply
  9. Merely wanna tell that this is very helpful , Thanks for taking your time to write this. “No kind of sensation is keener and more active than that of pain its impressions are unb1stakamle.&#822i; by Marquis de Sade.

    Reply

Leave a Reply