Finished Part A

Use record.open, not default constructor, to open/create recordfile
Editted comments and line breaks due to OCD
Closed recordfile after use
Moved variable initialization

More like true C code