added write to file functionality in cbc.cs