Routine used from ZSoft's pcx documentation
| 663 | |
| 664 | // Routine used from ZSoft's pcx documentation |
| 665 | ILuint encput(ILubyte byt, ILubyte cnt) |
| 666 | { |
| 667 | if (cnt) { |
| 668 | if ((cnt == 1) && (0xC0 != (0xC0 & byt))) { |
| 669 | if (IL_EOF == iputc(byt)) |
| 670 | return(0); /* disk write error (probably full) */ |
| 671 | return(1); |
| 672 | } |
| 673 | else { |
| 674 | if (IL_EOF == iputc((ILubyte)((ILuint)0xC0 | cnt))) |
| 675 | return (0); /* disk write error */ |
| 676 | if (IL_EOF == iputc(byt)) |
| 677 | return (0); /* disk write error */ |
| 678 | return (2); |
| 679 | } |
| 680 | } |
| 681 | |
| 682 | return (0); |
| 683 | } |
| 684 | |
| 685 | // This subroutine encodes one scanline and writes it to a file. |
| 686 | // It returns number of bytes written into outBuff, 0 if failed. |