#include "stdafx.h"
#include "paper015.h"
#include "paper015Dlg.h"
#include "math.h"
#include "engine.h"
#include <string.h>
#include <malloc.h>
#include <fstream.h>
public:
       typedef struct individual
{
double fitness;
unsigned *chrom;
double   varible[12];         //变量
int      xsite;               //位置          
      int      parent[2];           //父个体        
    double   Ts,Qp,Fz;            //相关值
};
struct OptPara
{
double Fz_Optimize,Qp_Optimize,Ts_Optimize;
double I,K;
double H[10];
};
    OptPara *AllPara;
void WriteAnsysTry(CString FileName, double *p);
    void StartEngine();
void CPaper015Dlg::OnButton1() 
{
for(int index=0;index<10;index++)
{
     for(int i=0;i<10;i++)
        AllPara[index].H[i]=sin(i+2);
        WriteAnsysTry("E:\\thesis\\program\\beamtry01.txt" , AllPara[index].H);
}
}
void CPaper015Dlg::WriteAnsysTry(CString FileName, double *p){ 
fstream outfile; 
outfile.open(FileName,ios::out); 
if(!outfile) 

MessageBox("File can't open\n"); 
abort(); 

outfile<<"/COM, Structural\n\
/PREP7\n\
/TITLE,GET MASS AND STIFFNESS MATRIX OF FLEXIBLE BEAM\n\ 
/UNITS,SI\n\ 
*SET,L,0.1\n"; 
*SET,B,0.002\n\ 
*SET,H,0.012\n"; 
//更改下面数据 
outfile<<"*SET,H1,"; 
outfile<<p[0]; 
outfile<<"\n*SET,H2,"; 
outfile<<p[1]; 
outfile<<"\n*SET,H3,"; 
outfile<<p[2]; 
outfile<<"\n*SET,H4,"; 
outfile<<p[3]; 
outfile<<"\n*SET,H5,"; 
outfile<<p[4]; 
outfile<<"\n*SET,H6,"; 
outfile<<p[5]; 
outfile<<"\n*SET,H7,"; 
outfile<<p[6]; 
outfile<<"\n*SET,H8,"; 
outfile<<p[7]; 
outfile<<"\n*SET,H9,"; 
outfile<<p[8]; 
outfile<<"\n*SET,H10,"; 
outfile<<p[9];
我想将上面的ANSYS APDL语言写入E:\thesis\program\beamtry01.txt中,但此段程序总是编译不过去,VC不识别APDL语句,还提示无法写入,请高手帮看看问题出在哪里?