Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program to implement the data link layer framing method character stuffing
#1

Code:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i,j,k,n,c=0,l;
char s[20];
clrscr();
printf("\t enter the string \n\t");
gets(s);
l=strlen(s);
printf("\t%d",l);
printf("\n\n");
j=0;
printf(" \tenter the frame size: \t ");
scanf("%d",&n);
k=l/n;
for(i=0;i<k;i++)
{
printf("\t DLESTX");
while(j<l)
{

putchar(s[j]);
c++;
j++;
if(c==n)
break;
}
printf(" DLESTX \t");
printf("\n\n");
c=0;
}
getch();
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Powered By MyBB, © 2002-2024 iAndrew & Melroy van den Berg.