b/c

This is a discussion on b/c within the C Programming forums, part of the General Programming Boards category; anyone know how to send integers to another computer via bioscom and recieve them on the other computer and execute ...

  1. #1
    me needs help
    Guest

    b/c

    anyone know how to send integers to another computer via bioscom and recieve them on the other computer and execute a piece of code? or even better tell me wots wrong with my code? (i've only included relevant parts of my code not the whole lot....

    ok....say i wanted to send a 5 across: heres my code:

    Code:
    int PumpNo, Key;
      char buffer[3];
    
      outtextxy(85,340, "Select Pump No.(1 to 8):");
      PumpNo=getch()-48;
      itoa(PumpNo,buffer,10);
      bioscom(1,buffer[3],COM1);
    that should send the number 5 across if five is pressed on the keyboard rite?

    then on the other computer i have this piece of code for receiving the five:

    Code:
    void fdp_author (void)
    {
    int PumpNo, xt, yt, bx, by, Key;
    char AuthKey;
    char buffer[3];
    	xt=100, yt=280, bx=130, by=310;
    		
            
    	bioscom(2,buffer[3],10); /*recieveing the five*/
    	cscanf("%s",buffer);
    	
           	PumpNo=getch()-48;   
    	switch(PumpNo){/ *graphics*/  
                    case 2:  xt = (xt+50),  bx = (bx+50);
    	  break;
    	case 3:  xt = (xt+100), bx = (bx+100);
    	  break;
    	case 4:  xt = (xt+150),  bx = (bx+150);
    	  break;
    	case 5:  xt = (xt+200),  bx = (bx+200);
    	  break;
    	case 6:  xt = (xt+250),  bx = (bx+250);
    	  break;
    	case 7:  xt = (xt+300),  bx = (bx+300);
    	  break;
    	case 8:  xt = (xt+350),  bx = (bx+350);
    	  break;}
      do
      {
    	if (kbhit())
    	Key = getch()-48;
    	setfillstyle(1,10);          /* Create Flashing green light */
    	bar(xt,yt,bx,by);
    	delay(400);
    	setfillstyle(1,2);
    	bar(xt,yt,bx,by);
    	delay(400);
      }while (Key !=PumpNo);
    ok so the aim of the program is to request a number from the user the take the number and transfer it to the other computer. The number once recieved must make the appropriate green light to flash (basically a button that is drawn on a picture. it flashes fine when i hit a key on the keyboard linked to the computer the program is running on but not when i send the number thru nothing flashes )

    ok my problem is that the 5 doesnt seem to make anything flash at the other end can someone tell me wots wrong with the program and please help me out? The communication stuff is set up rite its just the sending and receiving stuff thats not going rite!

    .......if anyone can help it would be gr8! thanks!!!! happy new yr

  2. #2
    Casual Visitor
    Join Date
    Oct 2001
    Posts
    350
    On my compiler

    unsigned _bios_serialcom( unsigned service, unsigned serial_port, unsigned data ); // prototype

    You need to change your order of access I *think*

    Code:
    #define COM1 0
    
    _bios_serialcom(_COM_SEND, COM1, data_to_send);
    
    _bios_serialcom(_COM_RECEIVE, COM1, date_to_receive);
    HTH
    I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another blow for video games
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 31
    Last Post: 09-18-2006, 05:30 AM
  2. 2 Million troops on the border
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 149
    Last Post: 06-04-2002, 09:37 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21