// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <graphics.h>

int main()
{
   FILE *fp;
   char line[133];
   int i,n,col;
   int gdriver,gmode;
   gdriver = DETECT;
   initgraph(&gdriver, &gmode, "C:\\BC31\\BGI");
   //printf("%s\n",grapherrormsg(graphresult()));
   fp=fopen("C:\\z.z","r");
   n=0;
   while(!feof(fp))
   {
      if(fgets(line,sizeof(line),fp))
      {
         for(i=0;i<(strlen(line)-1);i++)
         {
            switch(line[i])
            {
                case '1':
                    col = RED;
                    break;
                case '2':
                    col = GREEN;
                    break;
                case '3':
                    col = BLUE;
                    break;
                case '4':
                    col = YELLOW;
                    break;
                default:
                    col = BLACK;
                    break;
            }
            putpixel(i,n,col);
         }
         n++;         
      }
   }
   fclose(fp);
   getch();
   return 0;
}
