answersLogoWhite

0


Best Answer

#include

#include

main()

{

char a[20],fs[50]="",t[6],r[5];

int i,j,p=0,q=0;

clrscr();

printf("enter bit string : ");

scanf("%s",a);

strcat(fs,"01111110");

if(strlen(a)<5)

{

strcat(fs,a);

}

else

{

for(i=0;i

{

for(j=i;j

{

t[p++]=a[j];

}

t[p]='\0';

if(strcmp(t,"11111")==0)

{

strcat(fs,"111110");

i=j-1;

}

else

{

r[0]=a[i];

r[1]='\0';

strcat(fs,r);

}

p=0;

}

for(q=i;q

{

t[p++]=a[q];

}

t[p]='\0';

strcat(fs,t);

}

strcat(fs,"01111110");

printf("After stuffing : %s",fs);

getch();

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

here is c code for byte stuffing......

#include<stdio.h>

#include<conio.h>

#include<string.h>

void main()

{

char da[10]="NULL",data[10]="NULL",sy='@',re[10]="NULL";

int i,n,k=0,ct=0,len,w,s=0;

clrscr();

printf("\nHeader is inserted...('@')");

printf("\nEnter string:::");

gets(da);

strcpy(data,da);

len=strlen(da);

data[0]=sy;

for(i=0;i<=len;i++)

{

data[i+1]=da[i];

}

data[len+1]=sy;

printf("\nFooter is inserted...(@)");

printf("\nYour data::");

puts(data);

len=strlen(data);

printf("The data length %d",len--);

for(i=0;i<len;i++)

{

if(data[i]==sy)

{

s++;

}

}

printf("\nThe no of symbol is %d",s);

for(i=0;i<=len;i++)

{

if(data[i]==sy && i!=0 && i!=len)

ct++;

if(ct==1 && i!=len && i!=0)

{

re[i+k]=data[i];

k++;

re[i+k]=sy;

ct=0;

}

else

re[i+k]=data[i];

}

printf("\n\n\nByte stuffing::");

puts(re);

len=strlen(re);

printf("\n\nLength=%d",len);

getch();

}

This answer is:
User Avatar

User Avatar

Wiki User

7y ago

Bit stuffing has nothing to do with C Programming, although we can use C programming to implement bit stuffing.

Bit stuffing is the insertion of non-information bits into a data stream. This is typically done to ensure data streams with different bitrates are transmitted with a common bitrate or to synchronise channels prior to multiplexing.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the C program for byte stuffing?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Byte stuffing program in c?

teri bhen ki.....................


What is the bit stuffing and why you go for byte stuffing?

in bit stuffing we use data in bits !! in byte stuffing we use char !! thus in byte stuffing first char and converted in binary form and then bit stuffing is applied on it


What are the benefits of data stuffing?

The following data fragment occurs in the middle of a data stream for which the byte-stuffing algorithm described in the text is used: A B ESC C ESC FLAG FLAG D. What is the output after stuffing?


Write a program in c language to implement framing methods like character stuffing?

A program in c language to implement framing methods like character stuffing can be grave sizeCRC-32 and the variable c50.


What is byte stuffing in computer networking?

In byte stuffing (or character stuffing), a special byte is added to the data section of the frame when there is a character with the same pattern as the flag. The data section is stuffed with an extra byte. This byte is usually called the escape character (ESC), which has a predefined bit pattern. Whenever the receiver encounters the ESC character, it removes it from the data section and treats the next character as data, not a delimiting flag.


What has the author Bijan Mashaw written?

Bijan Mashaw has written: 'C++ programming byte by byte' 'Programming byte by byte' -- subject(s): FORTRAN 77 (Computer program language), Structured programming 'BASIC' -- subject(s): BASIC (Computer program language)


How is memory allocated in c program for a character data type?

One byte for every character.


How do you store the data into byte in c?

There is not built-in 'byte' type in C, but you can define it: typedef unsigned char byte; byte bmin=0, bmax=255;


Is the csg envelope stuffing program a scam?

Envelope stuffing is the number one job scam.


How do you detect an empty file in a c program?

Seek to the end of the file (fseek) and check how many bytes are in the file If the byte count is zero the file is empty.


What is the format specifire of data type BYTE?

Nothing (actually there is no BYTE in C). Use one of these: %c %x %u %o %d.


Write a program in java to print average no of alphabets present in each word?

import java.io.*; class AvgWordSent { protected static void main()throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter the Sentence: "); String s=in.readLine(); byte a=0,b=0; float c=0; for(byte i=0;i&lt;s.length();i++) { if(s.charAt(i)==' ') a++; } String w[]=new String[a+1]; for(byte i=0;i&lt;=a;i++) w[i]=""; for(byte i=0;i&lt;s.length();i++) { if(s.charAt(i)==' ') { b++; continue; } w[b]+=s.charAt(i); } b++; for(byte i=0;i&lt;=a;i++) c+=w[i].length(); System.out.print("Average no. of words= "+(c/b)); } }