Thread: .exe file doesn't work

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    2

    .exe file doesn't work

    hello everyone
    I have problem I found c code and I need to execute it in my java code I already know a method to execute c code in java but the problem now is that the c code is runing well using visual c++ 6.0 tool but the .exe file doesn't run that's why I'm unable to run the c code in java
    please can somebody help me to know why the .exe file doesn't run it produces error mesagges saying that fprintf() line 56
    please I need help
    thanks alot

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    How the heck are we supposed to know without the C source code???

  3. #3
    Registered User
    Join Date
    Dec 2009
    Posts
    2
    ok the main file is the following:
    Code:
    /*-------------------------------------------------------------------+
    |								                                                     |	
    |                  +------------------------------+                  |
    |                  | 	    Logic  Simulator   	    |                  |
    |                  +------------------------------+                  |
    |                         version 1.0                                |
    |                         Sept. 19 1989                              |
    |                       by Kyuchull Kim                              |
    |								                                                     |
    +-------------------------------------------------------------------*/
    #include	 "main.h"
    
    
    extern MakeNetwork();
    extern Get_level();
    extern Init_Network();
    extern Order_PO();
    extern Gettest();
    extern Simulate();
    extern gettest();
    PrintInput();
    PrintOutput();
    PrintGateValue();
    extern Get_Transition();
    extern Sort_Transition();
    
    
    /*******************************************************************/
    main(argc,argv)
       int  argc;
       char *argv[]; /* file name of network description */
    {
       int count = 0;
       char DATAname[50],NETname[50];
    	 
      
    //   struct tms buf1, buf2;
       
    
       accumulate=0;     /* default is not to accumulate the vectors */
       included=1;
    
       //readcommandline(argc,argv); 
    
    
    	 printf("Net Filename: ");
    	 scanf("%s",NETname);
    	 
    
    		strcpy(DATAname,NETname);
    		DATAname[0]='c';
    		strcat(NETname,".nf");
    		strcat(DATAname,".tc"); 
      
    	//	fnet=fopen(NETname,"r");
    	//	fvector=fopen(DATAname,"r");
    	//	fpo=fopen("out","w");
    
    
      if ((fnet=fopen(NETname,"r")) ==NULL) 
    		fprintf(fpo,"ERROR: cannot open netfile \n");
    
       if ((fvector=fopen(DATAname,"r")) == NULL)  
    		fprintf(fpo,"ERROR: cannot open vector file \n");
       if ((fpo=fopen("out","w")) ==NULL) 
    		fprintf(fpo,"ERROR: cannot open output file \n");
    
    
    	 fprintf(fpo,"********  Input file : %s ********* \n",DATAname);
    	
    
      accumulate = 0; 
       MakeNetwork(); /* read in network description from fnet & form a network */
        //  PrintNet(); 
    
    
       Get_level();
         // printpolist(); */ 
    
     
       Order_PO();
      //  /* printpolist(); */
    	 Init_Network();
    
      
       while (gettest() == OK){
    	  Simulate(count);
          count++; 
    
          PrintInput(count);    
          PrintOutput(count);
    
          if(!accumulate)
           // Reset_Network();
          Init_Network();     //Added AlShaibi */ 
    	  
       }
       TotalTestVec = count;
    
       PrintGateValue();
    
    
      
    }     /* end of main */
    
    /*-----------------------------------------------------------------*/
    /* purpose: print the value of PI                                  */
    /*-----------------------------------------------------------------*/
    PrintInput(count)
    int count;
    {
        int i; 
        ListNode *ptr;
    
       // fprintf(fpo,"IV%4d:",count);
        ptr = PI_List;
        for(i=0; ptr != NULL; i++) {
           //if (i > 10 ){ fprintf(fpo,"\n       "); i=0; }
         //  fprintf(fpo,"%d/%c ",GATENAME(ptr->gateno),(GATEVALUE(ptr->gateno) == X) ?
    	  //   'X' : (GATEVALUE(ptr->gateno)&1) + '0');
           ptr = ptr->next;
        }
        //fprintf(fpo,"\n");
    }
    
    /*-----------------------------------------------------------------*/
    /* purpose: print the value of PO                                  */
    /*-----------------------------------------------------------------*/
    PrintOutput(count)
    int count;
    {
       ListNode *ptr;
       int i;
    
       ptr = PO_List;
       //fprintf(fpo,"OV%4d:",count);
       for(i = 0; ptr != NULL; i++){
         // if (i > 10 ){ fprintf(fpo,"\n       "); i=0; }
         // fprintf(fpo," %d/%c",GATENAME(ptr->gateno),(GATEVALUE(ptr->gateno) == X)?
                //  'X':(GATEVALUE(ptr->gateno)&1) + '0');
          ptr = ptr->next;
       }
       //fprintf(fpo,"\n");
       return 0;
    }
    
    /*-----------------------------------------------------------------*/
    /* purpose: print the value of PO                                  */
    /*-----------------------------------------------------------------*/
    PrintGateValue(){
       int i,j,gp,k;
    
       
       //fprintf(fpo,"***** NodeValues **************\n");
       
       for( k = 0; k<TotalGate; k++){
    	   fprintf(fpo,"%s ",Gate[k].name);}
         fprintf(fpo,"\n");
    
    
        for(i = 0; i<TotalTestVec; i++){
    	//fprintf(fpo,"TestV %d: ",i);
    
    	for(j = 0; j<TotalGate; j++){
    		if(Gate[j].value[i]== X)
          fprintf(fpo,"%c",'X');
    		else {
    			gp = GATEnode[j];
    
    	   //fprintf(fpo," %s",Gate[j].name);
    	   //fprintf(fpo,"\n");		
    			fprintf(fpo,"%d",Gate[j].value[i]&1 + '0');
    		}
    	}
    	  fprintf(fpo,"\n");
    	}
       fprintf(fpo,"\n");
       return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  2. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  3. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  4. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  5. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM