home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
412.lha
/
crabs
/
rotate.c
< prev
Wrap
C/C++ Source or Header
|
1990-08-29
|
614b
|
32 lines
/*
** This program filters a small file such that the output
** is rotated 90 degrees
** NOTE the file must be a rectangle to work and no tabs
*/
#include <stdio.h>
char file[100][100];
int linelen, numlines;
main()
{
int i,j;
char c;
linelen = 0;
numlines = 0;
while (gets(&file[numlines][0]) != NULL && numlines < 99) {
if ((i = strlen(&file[numlines][0])) > linelen)
linelen = i;
numlines++;
}
for (i = linelen-1; i >= 0; i--) {
for( j=0; j <numlines; j++ ){
putchar((c=file[j][i])?c:' ');
}
putchar('\n');
}
return 0;
}