On Sun, 30 Mar 2008 02:22:25 -0700, c gordon liddy wrote:
> What follows pur****ts to be a soln for K&R 8-1 that prints bit****fted
> control chars and non-ascii chars:
[snippage]
> How would I populate a file containing non-ascii and ctrl chars for test
> purposes? (Does anyone have one?)
mkchars.c:
#include "stdio.h"
unsigned char i;
int main(int argc, char * argv[])
{
unsigned char buffer[256];
do { buffer[i] = i; } while(++i);
fwrite(buffer, 256, 1, stdout);
return 0;
}
make mkchars
../mkchars >samplechars
../catv samplechars
Many terminal emulators will react oddly if you fail to redirect. Don't
../mkchars
Many editors will behave badly if you try to edit samplechars.
Martin
--
Martin Golding DoD #0236 | fogobum@[EMAIL PROTECTED]
Always code as if the person who ends up maintaining your code will be a
violent psychopath who knows where you live.
y