home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 412.lha / crabs / rotate.c < prev   
C/C++ Source or Header  |  1990-08-29  |  614b  |  32 lines

  1. /*
  2. ** This program filters a small file such that the output
  3. ** is rotated 90 degrees
  4. **  NOTE the file must be a rectangle to work and no tabs
  5. */
  6.  
  7. #include <stdio.h>
  8.  
  9. char            file[100][100];
  10. int             linelen, numlines;
  11.  
  12. main()
  13. {
  14.   int             i,j;
  15.   char    c;
  16.  
  17.   linelen = 0;
  18.   numlines = 0;
  19.   while (gets(&file[numlines][0]) != NULL && numlines < 99) {
  20.     if ((i = strlen(&file[numlines][0])) > linelen)
  21.       linelen = i;
  22.     numlines++;
  23.   }
  24.   for (i = linelen-1; i >= 0; i--) {
  25.     for( j=0; j <numlines; j++ ){
  26.       putchar((c=file[j][i])?c:' ');
  27.     }
  28.     putchar('\n');
  29.   }
  30.   return 0;
  31. }
  32.