{ // constructor for MyWriter object public MyWriter( string fileName ) : base( fileName ) { } // end constructor
// write integer to file
public void WriteInteger( int output ) { // pad the integer with zeros string toWrite = output.ToString().PadLeft( 10, '0' );
Write( toWrite ); // write to file
} // end method WriteInteger
// write boolean to file
public void WriteBoolean( bool output ) { // a written boolean is 5 characters long if ( output ) Write( "true " ); else Write( "false" ); } // end method WriteBoolean
// write string to file
public void WriteString( string output ) { // each string ends with "ENDOFSTRING" Write( output + "ENDOFSTRING" ); } // end method WriteString } // end class MyWriter