#include #include #include /* This was written for the ipaq to load an mp3 file into memory * (in the background, hence the nanosleep) so that the mp3 player * doesn't spin the disk up every few seconds and waste batteries. */ int main(void) { char c; int a=0; struct timespec delay = { 0, 1 }; while (read(0, &c, 1) > 0) { if (lseek(0, 1023, SEEK_CUR)<0) break; if (++a % 4 == 0) nanosleep(&delay, 0); } exit(0); }