好的,不过程序有点长:
void ansnode(int num,CArray<double,double&> m_adX, CArray<double,double&> m_adY, CArray<double,double&> m_adZ);
//定义函数。
函数体:
void ansysdata::ansnode(int num,CArray<double,double&> *m_adX, CArray<double,double&>
*m_adY, CArray<double,double&>
*m_adZ)
{
double x, y,z;
int i;
fstream infilex;
fstream infiley;
fstream infilez;
infilex.open("d:\intface\M_ADX.TXT.txt",ios::in);
infiley.open("d:\intface\M_ADX.TXT.txt",ios::in);
infilez.open("d:\intface\M_ADX.TXT.txt",ios::in);
for (i=0;i<num;i++)
{
infilex>>x;
infiley>>y;
infilez>>z;
m_adX.Add(x);
m_adY.Add(y);
m_adZ.Add(z);
}
fstream outfilex;
fstream outfiley;
fstream outfilez;
outfilex.open("d:\intface\M_ADX1.TXT.txt",ios::in);
outfiley.open("d:\intface\M_ADX2.TXT.txt",ios::in);
outfilez.open("d:\intface\M_ADX3.TXT.txt",ios::in);
for (i=0;i<num;i++)
{
outfilex<<m_adX.GetAt(i)<<endl;
outfiley<<m_adY.GetAt(i)<<endl;
outfilez<<m_adZ.GetAt(i)<<endl;
}
}
谢谢,呵呵。