#include <stdio.h>
#include <ctype.h>
#define seek_set 0

int main(int argc, char *argv[])
{ FILE *update;
 int fpos;  /* read or write position in file */
 char c;
 if ((update = fopen(argv[1], "r+")) == NULL)
   { fprintf(stderr, "%s: cannot open %s for updating\n",
	     argv[0], argv[1]);
   exit(1);
   }
 while ((c = fgetc(update)) != EOF) 
   { if ( isupper(c) )
     {  ungetc(c, update);              /* back up 1 character  (a) */
     fpos = ftell(update);           /* get current position (b) */
     fseek(update, fpos, seek_set);  /* position for writing (c) */
     fputc(tolower(c), update);
     fpos = ftell(update);
     fseek(update, fpos, seek_set);  /* position for reading (d) */
     }
   }                                    /*                      (e) */
 fclose(update);
}
