HI,
i have written the code below. I need help on how to modify the program so that it takes its input (reads) from a file and then the data read from the port is returned to another new file specified by a user. This program has been written to send data to and read from an encrypting circuitry ( stream cipher).
SOFTWARE DESIGN.
/* *******************************************************/
/*This program is intended to WRITE and READ data to and from the SPP port */
/*Author: Mr.Kebungo Dominic. */
/*Date: 8-12 Feb. 2005.
/*Reference: . */
/******************************************************************/
#include <stdio.h> /* required so as to access the filesystem*/
#include <dos.h>
#include <time.h>
#define DATA 0x378 /*Data Register base address*/
#define STATUS DATA+1 /* Status Register address*/
#define CONTROL DATA+2 /*Control Register address*/
main()
{
char s;
char c;
c='A';
outport(CONTROL,inportb(CONTROL)&0xF0|0x04); /*initialise the
CONTROL port for data input*/
outportb(DATA, c); /*write c to the DATA register*/
delay(4);/*allow for propagation delay time*/
s=(inportb(STATUS)&0xF0); /* read MSnibble*/
s=s|(inportb(CONTROL)&0x0F);/*Read LSnibble*/
s=s^0x84; /*toggle bit 2 and 7 */
/*pins 11 and 14 are hardware inverted*/
printf("character: %c becomes: %c\n", c,s);
return (0);
}
i have written the code below. I need help on how to modify the program so that it takes its input (reads) from a file and then the data read from the port is returned to another new file specified by a user. This program has been written to send data to and read from an encrypting circuitry ( stream cipher).
SOFTWARE DESIGN.
/* *******************************************************/
/*This program is intended to WRITE and READ data to and from the SPP port */
/*Author: Mr.Kebungo Dominic. */
/*Date: 8-12 Feb. 2005.
/*Reference: . */
/******************************************************************/
#include <stdio.h> /* required so as to access the filesystem*/
#include <dos.h>
#include <time.h>
#define DATA 0x378 /*Data Register base address*/
#define STATUS DATA+1 /* Status Register address*/
#define CONTROL DATA+2 /*Control Register address*/
main()
{
char s;
char c;
c='A';
outport(CONTROL,inportb(CONTROL)&0xF0|0x04); /*initialise the
CONTROL port for data input*/
outportb(DATA, c); /*write c to the DATA register*/
delay(4);/*allow for propagation delay time*/
s=(inportb(STATUS)&0xF0); /* read MSnibble*/
s=s|(inportb(CONTROL)&0x0F);/*Read LSnibble*/
s=s^0x84; /*toggle bit 2 and 7 */
/*pins 11 and 14 are hardware inverted*/
printf("character: %c becomes: %c\n", c,s);
return (0);
}