home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD2.mdf
/
c
/
library
/
mslang
/
cp1
/
rs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-17
|
1KB
|
37 lines
===========================================================================
BBS: The Abacus * HST/DS * Potterville MI
Date: 06-14-93 (09:21) Number: 39
From: DAVID HARMON Refer#: 128
To: JEFFERY FOY Recvd: NO
Subj: Reverse sorting? Conf: (36) C Language
---------------------------------------------------------------------------
OK, here's one for you. Sleazy, but you get what you pay for.
Just be glad I didn't post it with the lines reversed!
#include <stdio.h>
main()
{
int i = 0;
char buff[256];
long fpos[1000];
while (fpos[i] = ftell(stdin),
fgets(buff, sizeof buff, stdin)) {
i++;
}
while (--i >= 0) {
fseek(stdin, fpos[i], SEEK_SET);
fgets(buff, sizeof buff, stdin);
fputs(buff, stdout);
}
return 0;
}
... This message released to public domain. Use at your own risk. DDH
--- Blue Wave/Max v2.10 [NR]
* Origin: Long_Island RB (310) 370-4113 VAX EC (HST 16.8K/V32b) (1:102/138.0)
SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209
SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2270/1 2430/1 2440/5 3603/20