【单选题】
在窗体上有两个名称分别为Text1、Text2的文本框,一个名称为Command1的命令按钮。运行后的窗体外观如图所示。

设有如下的类型和变量声明:Private Type Person nameAs String*8 majorAs String*20 End Type Dim pAs Person设文本框中的数据已正确地赋值给Person类型的变量P,当单击“保存”按钮时,能够正确地把变量中的数据写入随机文件Test2.dat中的程序段是A.Open "c:\Test2.dat" For OutputAs #1Put #1,1,P Close #1
B.Open "c:\Test2.dat" For RandomAs #1Get #1,1,P Close #1
C.Open "c:\Test2.dat" For RandomAs #1 Len=Len(p)Put #1,1,P Close #1
D.Open "c:\Test2.dat" For RandomAs #1 Len=Len(p)Get #1,1,P Close #1