readit.c 409 B

1234567891011121314151617181920212223242526272829
  1. #include <stdio.h>
  2. struct frec {
  3. int indx;
  4. char c[74];
  5. } rec;
  6. void main()
  7. {
  8. FILE *fp;
  9. char *cp, buf[75];
  10. int i,x,mask,c;
  11. fp = fopen("dtext.dat","rb");
  12. x = 0;
  13. buf[74] = 0;
  14. while (fread(&rec,sizeof(rec),1,fp) == 1) {
  15. x++;
  16. for (i=1; i<75; i++) {
  17. mask = (x & 31)+i;
  18. buf[i-1] = rec.c[i-1] ^ mask;
  19. }
  20. cp = &buf[73];
  21. while (*cp == ' ') *cp-- = 0;
  22. printf("%d %s\n",rec.indx,buf);
  23. }
  24. }