I'm using Visual Studio 2005 to write a C/C++ program.
I declare the following struct that contains an array:
I call a function that creates a struct for MetaFrag,
ParaFrag etc..(showing the MetaFrag Example):
The program compiles fine, but it only works if I call 3 or
less of the data elements.
For example, I can call createmetafile, createparafile and
create phenofile and it works fine. However, if I add the 4th call, create phenopfile, it blows up when I try to run it. I've switched the calls around to make sure it wasn't specific to the function being called.
Does anyone see what I'm doing wrong? Any help is greatly appreciated
I declare the following struct that contains an array:
Code:
typedef struct DataElement {
char Fragment[45];
double FragVal;
int NumFound;
int FragID;
char FragDisplay[45];
} MetaFrag, ParaFrag, PhenOFrag,PhenPFrag;
I call a function that creates a struct for MetaFrag,
ParaFrag etc..(showing the MetaFrag Example):
Code:
MetaFrag *MF = NULL;
MF = CreateMetaFile();
//CreateMetaFile()
MetaFrag *CreateMetaFile( void )
{
MetaFrag *MF;
MF = new DataElement [ 351 ];
int n = 0;
//0 - 10
strcpy(MF[n].Fragment,"R{A}CCCCCCC");
strcpy(MF[n].FragDisplay,"CCCCCCC");
MF[n].FragVal = -0.19;
MF[n].NumFound = 0;
MF[n].FragID = -1; n++;
//etc..
return( MF );
}
The program compiles fine, but it only works if I call 3 or
less of the data elements.
For example, I can call createmetafile, createparafile and
create phenofile and it works fine. However, if I add the 4th call, create phenopfile, it blows up when I try to run it. I've switched the calls around to make sure it wasn't specific to the function being called.
Does anyone see what I'm doing wrong? Any help is greatly appreciated