All pastes #1931861 Raw Edit

Adhoc by techblu3

public text v1 · immutable
#1931861 ·published 2010-09-03 16:54 UTC
rendered paste body
#include <stdio.h>
#include <conio.h>
int main(void)
{
	int source;
	int destination;
   int nextHop;
   int noOfHop=1;


   int src;
   int dstn;

   FILE *network;
 	printf("enter source and destination \n");
	scanf("%d%d", &src , &dstn);
   if(src==dstn)
   {
       printf("source and destination must be different" );
   }
   else
  {

   if(( network=fopen("graphics.txt" , "r" ))==NULL)
	{
		printf( "file could not be opened" ) ;

	}
   else
   {
   	 while( noOfHop != 0)
      {
      	network=fopen("graphics.txt" , "r" );
//      	fscanf(network , "%d%d%d%d" , &source , &destination ,
//&nextHop , &noOfHop);

   		while(1)
      	{
      		fscanf(network , "%d%d%d%d" , &source , &destination , &nextHop , &noOfHop);
         	if(src == source && dstn == destination ) break;
      	}
         printf("%d is copied to %d  \n" ,source, nextHop);
         src=nextHop;
         noOfHop--;
		   fclose (network);
      }
	}
  }
   getch();
   return 0;
}