#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int main(void)
{
int ia;
FILE *fpa;
void Display(FILE *fpa);
printf("This is a test.\n");
if ((fpa = fopen("main.c", "r")) == NULL)
{
printf("file can not be oepen.\n");
getch();
exit(1);
}
Display(fpa);
getch();
return 0;
}
void Display(FILE *fpa)
{
int ia, inum, imask = 1 << 15;
while (!feof(fpa))
{
inum = fgetc(fpa);
for (ia = 1; ia <= 16; ia++)
{
printf("%c", ((inum & imask) ? '1' : '0'));
inum <<= 1;
if (ia % 8 == 0)
{
putchar(' ');
}
}
}
}