Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Slanje file-a na port

[es] :: C/C++ programiranje :: Slanje file-a na port

[ Pregleda: 1544 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Tronic
Pula

Član broj: 48368
Poruke: 51
*.cmu.carnet.hr.

Sajt: www.veleri.hr/~kcetina


Profil

icon Slanje file-a na port18.03.2005. u 20:49 - pre 232 meseci
Ok, kako poslati file na com port.
Polako gubim kosu zbog ovoga
Code:

#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <conio.h>
#include <graphics.h>

#define PORT1 0x3F8


int main ()
{
     FILE *fp;
     char file_name [12];
     int c, ch;
     textcolor (11);
     textbackground (1);
     clrscr ();

     outportb (PORT1 + 1 , 0);        //Turn off interrupts - PORT1
     outportb (PORT1 + 3 , 0x80);    //Set DLAB on
     outportb (PORT1 + 0 , 0x03);    //BaudRate 38.400 bps- Divisor Latch Low Byte
     outportb (PORT1 + 1 , 0x00);    //BaudRate- Divisor Latch High Byte
     outportb (PORT1 + 3 , 0x03);    //8 Bits, No Parity, 1 Stop Bit
     outportb (PORT1 + 2 , 0xC7);    //FIFO Control Register
     outportb (PORT1 + 4 , 0x0B);    //Turn on DTR, RTS and out2

     printf ("Unesite ime datoteke:");
     gets (file_name);
     
    if ( (fp = fopen(file_name, "r")) == NULL)
    {
        fprintf(stderr, "Greçka pri otvaranju datoteke %s.", file_name);
        system ("Pause");
        exit(1);
    }
    fclose (fp);
    
    outport (PORT1, ???); // možda ovdje dođe nešto???

return 0;
}

U pitanje je (kao što se vidi) Borland C compiler.
 
Odgovor na temu

[es] :: C/C++ programiranje :: Slanje file-a na port

[ Pregleda: 1544 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.