Thursday, 24 April 2014

STOP and Wait(have to insert timer) /Sliding window

#include<stdio.h>
#include<conio.h>
 struct file
 {
         
          char words[30];
 }fl[6];

 struct file1
 {
           
           char words[30];
 }fl1[6];

 int main()
           {
          FILE*fdata1,*fdata2;
          int index1,index2;
          int n=5;

           {
          fdata1=fopen("D:\\123.txt","a+");
          if(fdata1==NULL)
           {
          printf("ERROR");
           }
          else
               {
          for(index1=0;index1<n;index1++)

           {
          fscanf(fdata1,"%s",&fl[index1].words);
           }
    fclose(fdata1);
          fdata1=fopen("D:\\123.txt","a");
          fdata2=fopen("D:\\456.txt","a");
          if(fdata2==NULL)
          {
                          printf("ERROR");
           }
          else
 {
          for(index2=0;index2<n;index2++)
 {
         
          fprintf(fdata2,"%s\n",fl[index2].words);       
          fprintf(fdata2,"Acknowledgement send\n");
          fprintf(fdata1,"Acknowledgement recieved for \t");
          fprintf(fdata1,"%s\n",fl[index2].words);
         
 }

 }
         
}
fclose(fdata1);
fclose(fdata2);
getch();
}
}


No comments:
Write comments

Featured post

List of Universities in Karnataka offering M.Sc Computer Science

The post-graduate programme in Computer Science (M.Sc Computer Science) contains two academic years duration and having a four semesters....

Popular Posts

Copyright @ 2011-2016