Você está na página 1de 1

#include<stdio.

h>
#include<conio.h>
#include <bios.h>
#include <dos.h>
#define
#define
#define
#define
#define

COM1
0
DATA_READY 0x100
TRUE
1
FALSE
0
SETTINGS (_COM_9600 | _COM_CHR8 | _COM_STOP1 | _COM_NOPARITY)

long ftamanio(FILE *archi)


{
fseek(archi,0,SEEK_END);
long tamanio=ftell(archi);
fseek(archi,0,SEEK_SET);
return tamanio;
}
void main (void)
{
char cadena [30];
FILE *fichero;
char c;
long taman;
unsigned in, out, status;
_bios_serialcom(_COM_INIT, COM1, SETTINGS);
cprintf("... _BIOS_SERIALCOM [ESC] to exit ...\r\n");
printf("dame el nombre del archivo ");
scanf("%s",cadena);
fichero=fopen(cadena,"r");
if(NULL==fichero)
{
printf("archivo no encontrado \n");
getch();
}
else
{
for(int i=0;i<4;i++)
{
fread((void*)(&c),sizeof(char),1,fichero);
delay(1000);
_bios_serialcom(_COM_SEND, COM1, c);
putc(c,stdout);
}
printf("\n\n\n fin del programa\n");
fclose(fichero);
getch();
}
}

Você também pode gostar