- char buffer[100];
- char text[] = "SUCCESS testing fputs().";
- TESTCASE( ( fh = fopen( "testfile", "w" ) ) != NULL );
- TESTCASE( fputs( text, fh ) != EOF );
- TESTCASE( fclose( fh ) == 0 );
- TESTCASE( ( fh = fopen( "testfile", "r" ) ) != NULL );
- TESTCASE( fread( buffer, 1, strlen( text ), fh ) == strlen( text ) );
- TESTCASE( memcmp( buffer, text, strlen( text ) ) == 0 );
+ TESTCASE( ( fh = tmpfile() ) != NULL );
+ TESTCASE( fputs( message, fh ) >= 0 );
+ rewind( fh );
+ for ( size_t i = 0; i < 23; ++i )
+ {
+ TESTCASE( fgetc( fh ) == message[i] );
+ }