3 Converts a file to uppercase in-place.
5 Incidentally, another way to do this while avoiding the seeks
6 would be to open the input file, then remove() it and reopen
7 it under another handle. Because of Unix deletion semantics
15 main (int argc, char *argv[])
23 handle = open (argv[1]);
31 n = read (handle, buf, sizeof buf);
35 for (i = 0; i < n; i++)
36 buf[i] = toupper ((unsigned char) buf[i]);
38 seek (handle, tell (handle) - n);
39 if (write (handle, buf, n) != n)
40 printf ("write failed\n");