You do it exactly like in Turbo Pascal. Write a procedure assign_xxx, that fills the fields of a textrec. Then close output, assign, and open.

If you need an example, look at the source code of the crt unit, assignCRT and friends.