#include #include /* mytolower: c を小文字に変換する;ASCIIのみ */ int mytolower(int c) { if( c >= 'A' && c <='Z' ) return( c + 'a' - 'A' ); else return( c ); } main() { int c, n; for( n = 0, c = 0; c <= 127; c++ ) if( isprint(c) ) { printf("%02x=%c ", c, c ); if( ++n%8 == 0 ) printf("\n"); } printf("\n"); for( n = 0, c = 0; c <= 127; c++ ) if( tolower(c) != mytolower(c) ) { printf("tolower(%02x)=%02x, mytolower(%02x)=%02x\n", c, tolower(c), c, mytolower(c) ); n++; } if( n == 0 ) printf("mytolower() is OK!\n"); else printf("mytolower() is NG!\n"); } /* end of testmytolower.c */