added function ...write_scaffold into test.c