// copy stdin to stdout line-by-line using fgets() and fputs() // #include #include int main( void) { char line[BUFSIZ]; // line[0] is a char, &line[0] == line printf( "BUFSIZ = %i\n", BUFSIZ); while(1) { if( fgets( line, BUFSIZ, stdin) == NULL) break; fputs( line, stdout); // upper case for( char *p = line; *p; ++p) *p = toupper(*p); fputs( line, stdout); } }