Click here to Skip to main content
15,897,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Problem with COleDateTime obj Pin
misturas4-Dec-05 7:28
misturas4-Dec-05 7:28 
GeneralRe: Problem with COleDateTime obj Pin
David Crow5-Dec-05 2:49
David Crow5-Dec-05 2:49 
QuestionCEdit scrollbar color Pin
Junyor1-Dec-05 2:11
Junyor1-Dec-05 2:11 
QuestionDll Error: Debug assertion failed? Pin
Amol Ravatale1-Dec-05 1:48
Amol Ravatale1-Dec-05 1:48 
QuestionRe: Dll Error: Debug assertion failed? Pin
David Crow1-Dec-05 4:42
David Crow1-Dec-05 4:42 
AnswerRe: Dll Error: Debug assertion failed? Pin
Amol Ravatale1-Dec-05 18:05
Amol Ravatale1-Dec-05 18:05 
GeneralRe: Dll Error: Debug assertion failed? Pin
David Crow2-Dec-05 3:42
David Crow2-Dec-05 3:42 
GeneralRe: Dll Error: Debug assertion failed? Pin
Amol Ravatale4-Dec-05 19:08
Amol Ravatale4-Dec-05 19:08 
Contents : -Data Structures used in Linked List
-Class namely 'DataType' having properties and methods to
create linked list
-the function in which linked list is created
//***************************************************************************************************
// Vector structure: This structure is used to emulate "Vectors" section of ABF file.
//**************************************************************************************************
typedef struct tag_VECTOR
{
char lpszVectorDescription[5] ; //1) Vector description as a variable length string.
char lpszVectorName[7] ; //2) Vector name as a variable length string.
char lpszEquation[5] ; //3) Equation as a variable length string. I read but ignore this value.
long int lNoOfPoints ; //4) Number of points in vector as a four-byte integer.
long int lNoOfBytes ; //5) Number of bytes in each point, either four or eight for single and double precision. The GM Safety Lab data uses single precision.
long int lBinaryFlag ; //6) Binary flag as four-byte integer, always set to one.
float lpDataValue[10000] ; //7) The four or eight byte binary, floating-point data values. The total number of bytes in this section is the product of the values read in four and five, above.

}VECTOR, *LPVECTOR;

//**************************************************************************************************************
//The request description is made up of the channel name, anomaly error (if any), channel description,
//channel number, units, filter, and file name. For example:
//aa001a, ANOMALY = Data Affected by Accelerometer Rotation, CTR FRT C/MBR ON SENSOR LONGITUDINAL ACCEL, G'S, Channel = 123, Units = G's, Filter = 1000, File = c12001a
//To model this sequence I am writing following structure
//**************************************************************************************************************

typedef struct tag_REQUEST_DESCRIPTION
{
char lpszChannelName[25] ; //1) Channel name and is assigned as Request name
char lpszAnomalyError[20] ; //2) Anaomaly Error if any.
char lpszChannelDescription[25] ; //3) Channel Description
char lpszChannelNumber[4] ; //4) Channel Number
char lpszUnits[15] ; //5) Channel units
char lpszFilter[10] ; //6) Filter
char lpszFileName[15] ; //7) FileName

}REQUEST_DESCRIPTION, *LPREQUEST_DESCRIPTION ;


//***************************************************************************************************
// Request Structure: This structure is used to emulates "Requests" section of ABF file.
//***************************************************************************************************

typedef struct tag_REQUEST
{
REQUEST_DESCRIPTION RequestDescription ; //1) Request description as a variable length string.
char lpszRequestName[35] ; //2) Request name as a variable length string.
char lpszRequestNameRe[35] ; //3) Request name, repeated, as a variable length string. I read but ignore this value.
char lpszTotalDescription[240] ; //4) Total description is string formed by concating all elements of "RequestDescription" element
tag_REQUEST *NextRequest ; //5) This points to next request of same data type. If no next request is available it is NULL
LPVECTOR lpVector ; //6) This points to vector

}REQUEST, *LPREQUEST;


//****************************************************************************************************
// Data Type Structure: This structure is used to emulate "Data Types" section of ABF file
//****************************************************************************************************

typedef struct tag_DATA_TYPE
{
char lpszDataTypeDescription[25] ; //1) Data Type description as a variable length string.
char lpszDataTypeName[25] ; //2) Data Type name as a variable length string.
long int lDefaultTimeDataType ; //3) Flag indicating if this is the one and only default time Data Type. This is a four-byte integer,1 = true, 0 = false. At most only one Data Type in each file may set this to true.
long int lNoOfRequests ; //4) Number of requests as a four-byte integer. This number denotes the number of channels, in given data set, of same data type
long int lNoOfComponents ; //5) Number of components as a four-byte integer.
tag_DATA_TYPE *NextDataType ; //6) This points to next data type.
LPREQUEST lpRequest ;

}DATA_TYPE,*LPDATA_TYPE ;

class DataType
{
private:

LPDATA_TYPE m_Node ; //This acts as a Base Node

public:

DataType();
~DataType();
void AppendDataType(LPDATA_TYPE) ; //adds a new node at the end of the linked list
void AddDataTypeatBeg(LPDATA_TYPE) ; //add a new node at the begining. this way the, after adding the first node becomes second node
void AddDataTypeAfter(LPDATA_TYPE, int Num) ; //add a new node after nth node(2nd argument)
LPDATA_TYPE FindDataType(LPDATA_TYPE) ; //find node with desired data type
LPDATA_TYPE GetDataType(int Num) ; //get the nth node
int GetTotalDataTypes() ; //get total number of data types available:this is equal to number of nodes in link list
LPDATA_TYPE GetNewDataType() ; //This creates a new pointer to DATA_TYPE structure on HEAP and returns the same
LPREQUEST GetNewRequest() ; //This creates a new pointer to REQUEST structure on HEAP and returns the same
LPVECTOR GetNewVector(int DataPoints, int NoOfBytes=4) ; //This creates a new pointer to VECTOR structure on HEAP and returns the same
void AppendRequest(LPREQUEST,LPDATA_TYPE) ; //Append request to the last request of data type given as second argument
};

DataType::DataType()
{
m_Node = NULL ;
}

//**************************************
// Destroy the link list objects
//**************************************
DataType::~DataType()
{
LPDATA_TYPE Tempdata; LPREQUEST TempRequest ; LPVECTOR TempVector;

if(m_Node==NULL)
return;

while(m_Node != NULL)
{
if(m_Node->NextDataType !=NULL)
{
TempRequest = m_Node->lpRequest ;
while(TempRequest != NULL)
{
LPREQUEST temprequest1 = TempRequest->NextRequest ;

//delete TempRequest->lpVector->lpDataValue ;
delete TempRequest ;
TempRequest = temprequest1 ;
}

Tempdata = m_Node->NextDataType ;
delete m_Node;
m_Node = Tempdata;
}
else //if there is only one link list object or if there are n nodes, then the above "if" condition deletes (n-1), for deleting last this else condition is written.
{
TempRequest = m_Node->lpRequest ;
while(TempRequest != NULL)
{
LPREQUEST temprequest1 = TempRequest->NextRequest ;

//delete TempRequest->lpVector->lpDataValue ;
delete TempRequest ;
TempRequest = temprequest1 ;
}
delete m_Node ;
m_Node = NULL ;
}
}

}

//******************************************
// Purpose: adds a new code of DATA_TYPE
//******************************************
void DataType::AppendDataType( LPDATA_TYPE NewNode)
{
LPDATA_TYPE Temp1, Temp2;

NewNode->lNoOfComponents =1;
NewNode->lNoOfRequests =1 ;
NewNode->lDefaultTimeDataType =0 ;

if(m_Node ==NULL) //If Base node in NULL.
{
//Create the First Base Node
m_Node = NewNode ;
m_Node->NextDataType = NULL;
}
else
{
//Go to the Last Node
Temp1 = m_Node ;
while(Temp1->NextDataType != NULL)
Temp1 = Temp1->NextDataType ;

//Add Node at the End
Temp2 = NewNode ;
Temp2->NextDataType = NULL;

Temp1->NextDataType = Temp2 ;
}
}

//************************************************************************************************
// This Function adds a NewRequest, passed as 1st argument, to the given DataType, 2nd argument.
//************************************************************************************************

void DataType::AppendRequest(LPREQUEST NewRequest,LPDATA_TYPE ToThisDataType)
{
LPDATA_TYPE TempDataType; LPREQUEST TempRequest ;

if(ToThisDataType->lpRequest == NULL) //If immediate pointer to request, an element of DataType, is NULL.
{
ToThisDataType->lpRequest = NewRequest ;
ToThisDataType->lpRequest->NextRequest = NULL ; //recent
}
else
{
TempRequest = ToThisDataType->lpRequest;
while(TempRequest->NextRequest != NULL ) // Move to last request
TempRequest = TempRequest->NextRequest ;

TempRequest->NextRequest = NewRequest ;
TempRequest->NextRequest->NextRequest = NULL ; //recent
}

}
//************************************************************
// This Functions makes passed argument as the Base node
//************************************************************
void DataType::AddDataTypeatBeg(LPDATA_TYPE NewNode)
{
LPDATA_TYPE Temp ;

//add new node
Temp = NewNode ;
Temp->NextDataType = m_Node ;
m_Node = Temp ;

}

//*************************************************************************************
// This Function adds new node of DATA_TYPE, after Num(2nd argument) no of nodes
//*************************************************************************************
void DataType::AddDataTypeAfter(LPDATA_TYPE NewNode, int Num)
{
LPDATA_TYPE Temp1, Temp2; int count ;

for(count=0,Temp1=m_Node;count < Num;count++)
{
Temp1 = Temp1->NextDataType ;
if(Temp1 == NULL)
return ;
}

//insert new node
Temp2 = NewNode ;
Temp2->NextDataType = Temp1->NextDataType ;
Temp1->NextDataType = Temp2;
}

//************************************************************************************
// This Function returns datatype node of nth num(which is passed as 2nd argument)
//************************************************************************************
LPDATA_TYPE DataType::GetDataType(int Num)
{
LPDATA_TYPE Temp ; int count ;
Temp=m_Node ;
if(Num==1)
return Temp ;

for(count=2;count <=Num;count++)
{
Temp = Temp->NextDataType ;
if(Temp == NULL)
return NULL;
}
if(Temp ==NULL)
return NULL;
else
return Temp;
}

//***************************************************************************************
// Purpose : Searches datatype node
// Searching Criteria : DataTypeName, which is an element of DATA_TYPE node.

// Return Value : If desired node of same Data Type name is found in Linked list,
// then the node passed as argument to this function is delete, as
// already DataType node of data Type Name exists, and the pointer
// to the available node is returned back.
// If no node is present, NULL is returned.
//***************************************************************************************

LPDATA_TYPE DataType::FindDataType(LPDATA_TYPE Node)
{
LPDATA_TYPE Temp = m_Node ; int count ;
while(Temp != NULL)
{
if(strcmp(Temp->lpszDataTypeName,Node->lpszDataTypeName)==0) //If you find a data type, delete new created data type object
{
delete Node ;
return Temp ;
}
Temp = Temp->NextDataType ;
}
return NULL ;

}

//*****************************************************************************************
// Purpose : Total number of data type nodes that are available in the Linked List
// Return Value: Total No of Data types
//*****************************************************************************************
int DataType::GetTotalDataTypes()
{
LPDATA_TYPE Temp = m_Node ; int Total=0;
while(Temp != NULL)
{
Temp = Temp->NextDataType ;
Total++;
}
return Total ;
}

//*************************************************************************
// Purpose : Function creates object of structure DATA_TYPE on Heap.
// Sets Request & NextdataType element of its as NULL.
// Return Value : Pointer to DATA_TYPE.
//*************************************************************************
LPDATA_TYPE DataType::GetNewDataType()
{
LPDATA_TYPE NewDataType ;
NewDataType = new DATA_TYPE ;

NewDataType->NextDataType = NULL ;
NewDataType->lpRequest = NULL ;

return NewDataType ;
}

//*************************************************************************
// Purpose : Function creates object of structure REQUEST on Heap.
// Sets NextRequest & Vector element of its as NULL.
// Return Value : Pointer to REQUEST.
//*************************************************************************
LPREQUEST DataType::GetNewRequest()
{
LPREQUEST NewRequest ;
NewRequest = new REQUEST ;

NewRequest->NextRequest = NULL;
NewRequest->lpVector = NULL ;

return NewRequest ;
}

//**************************************************************************************
// Purpose : Function creates object of structure VECTOR on Heap.
// Creates memory on heap for data points
// Parameters : 1st argument - denotes number of data points available in the channel
// : 2nd argument - denotes number of bytes for each data point.
// Return Value : Pointer to REQUEST.
//**************************************************************************************
LPVECTOR DataType::GetNewVector(int DataPoints,int NoOfBytes)
{
LPVECTOR NewVector ;
NewVector = new VECTOR ;

//NewVector->lpDataValue = new float[sizeof(DataPoints*NoOfBytes+5)];
return NewVector ;

}

Inside function body:
{
int StringLen ; //Used to get the lenght of any string and use it for any purpose such as allocationg memory of same lenght
float ActualValue ; //Used to store value retrived from channel
Units cUnit ; //
DataType *lpcDataType ; //To create Linked List

int TotalNoOfRequest=0 ; //Total requests irrespective of data type
int ChannelLen=0 ; //data Points in Channel
register int Index=1 ; //Used in For Loop , register storage class makes the processing faster
register int RowCount ; //Used in For Loop , register storage class makes the processing faster
TDataDouble dValueT ; // Local double variable
TDataChannelLenInfo DataChannelLenInfoT ; // Local length information for a data channel

//Set how many channels are there.
ABFFile.SetNoOfChannels(unsigned int (lChannelNos)) ; //This is neccessory to set the upper bound of array of datatypes, requests and vectors

// Request object channel length info for the first data channel using the property function
lDataObjProperties(lChannelNos,eChannelLenGet,sizeof(TDataChannelLenInfo),&DataChannelLenInfoT);
ABFFile.SetChannelLength((int)DataChannelLenInfoT.lLen) ;
//ABFFile.SetChannelLength((int)25) ;
ChannelLen = ABFFile.GetChannelLength() ;

if( ChannelLen <=0 )//If channel len <=0 return
{
MessageBox((HWND)hDIAdemWndGet(),"Invalid Channel Lenght/Data Points in channel","Invalid Data Points",MB_OK);
return ;
}

if (ChannelLen > 0) //VALIDATION NO 1:- this check will ensure that given channel number, as argument of this function contains data rows/data points. This instruction assumes that data for channels below channel number given as argument exists
{
lpcDataType = new DataType ;

FILE *pTxtFile ;
pTxtFile = fopen("ABFChnPro.txt","r");
if(pTxtFile == NULL)
{
MessageBox((HWND)hDIAdemWndGet(),"Failed to Open Text file ","Channel Properties File",MB_OK) ;
return ;
}

//details about data types
int k; int i=0; char data1[50], data2[50], data3[50], data4[50] ;
TDataObjHeader DataObjHeaderT ;
DataObjHeaderT.lSize = sizeof(TDataObjHeader) ;
//try
//{
k = fgetc(pTxtFile) ;
while('\n'!= (char)k)
{
LPDATA_TYPE TempDataType ; LPREQUEST TempRequest ; LPVECTOR TempVector ;
TempDataType = lpcDataType->GetNewDataType() ;
if(TempDataType == NULL)
{
MessageBox(NULL,"Enough memory is not available","Low memory",MB_OK);
return ;
}
TempRequest = lpcDataType->GetNewRequest();
if(TempRequest == NULL)
{
MessageBox(NULL,"Enough memory is not available","Low memory",MB_OK);
return ;
}
TempVector = lpcDataType->GetNewVector(ABFFile.GetChannelLength()) ;
if(TempVector == NULL || TempVector->lpDataValue == NULL)
{
MessageBox(NULL,"Enough memory is not available","Low memory",MB_OK);
return ;
}
i=0;
while('\n'!= (char)k) //This is name of channel
{
data1[i] = (char) k ;
i++;
k = fgetc(pTxtFile) ;
}
data1[i] = '\0' ;

i=0;
k = fgetc(pTxtFile) ;
while('\n'!= (char)k) //This is data type name
{
data2[i] = (char) k ;
i++;
k = fgetc(pTxtFile) ;
}
data2[i] = '\0' ;

strcpy(TempDataType->lpszDataTypeName,data2) ;
strcat(TempDataType->lpszDataTypeName,"\0");

i=0;
k = fgetc(pTxtFile) ;
while('\n'!= (char)k) //This is units of channel
{
data3[i] = (char) k ;
i++;
k = fgetc(pTxtFile) ;
}
data3[i] = '\0' ;

//request unit name ;
strcpy(TempRequest->RequestDescription.lpszUnits,data3); //aRequests[Index].RequestDescription.lpszUnits = new char[StringLen] ;
strcat(TempRequest->RequestDescription.lpszUnits,"\0") ; //strcpy(aRequests[Index].RequestDescription.lpszUnits,data3) ;

//data type description
strcpy(TempDataType->lpszDataTypeDescription,cUnit.GetDataDescription(data3)); //strcpy(aDataTypes[Index].lpszDataTypeDescription,cUnit.GetDataDescription(data3) ) ;
strcat(TempDataType->lpszDataTypeDescription,"\0");

strcpy(TempRequest->RequestDescription.lpszUnits,cUnit.GetDataDescription(data3));
strcat(TempRequest->RequestDescription.lpszUnits,"\0");

i=0;
k = fgetc(pTxtFile) ;
while('\n'!= (char)k) //This channel number
{
data4[i] = (char) k ;
i++;
k = fgetc(pTxtFile) ;
}
data4[i] = '\0' ;

strcpy(TempRequest->RequestDescription.lpszChannelNumber,data4) ;
strcat(TempRequest->RequestDescription.lpszChannelNumber,"\0") ;

k=(char )fgetc(pTxtFile) ;
k=(char )fgetc(pTxtFile) ;

nDataObjHeaderGet(Index,&DataObjHeaderT) ; //GPI SERVICE ROUTINE
//REQUEST NAME:-The request name is set to the channel name
strcpy(TempRequest->lpszRequestName,DataObjHeaderT.szName) ;
strcat(TempRequest->lpszRequestName,"\0") ;

strcpy(TempRequest->lpszRequestNameRe,DataObjHeaderT.szName) ;
strcat(TempRequest->lpszRequestNameRe,"\0") ;

strcpy(TempRequest->RequestDescription.lpszAnomalyError,"NA") ;
strcat(TempRequest->RequestDescription.lpszAnomalyError,"\0") ;

strcpy(TempRequest->RequestDescription.lpszChannelName,DataObjHeaderT.szName);
strcat(TempRequest->RequestDescription.lpszChannelName,"\0") ;

strcpy(TempRequest->RequestDescription.lpszChannelDescription,"NA");
strcat(TempRequest->RequestDescription.lpszChannelDescription,"\0");

strcpy(TempRequest->RequestDescription.lpszFileName,"NA");
strcat(TempRequest->RequestDescription.lpszFileName,"\0");

strcpy(TempRequest->RequestDescription.lpszFilter,"NA");
strcat(TempRequest->RequestDescription.lpszFilter,"\0");

if(TempRequest->RequestDescription.lpszChannelName != NULL)
{
strcpy(TempRequest->lpszTotalDescription,TempRequest->RequestDescription.lpszChannelName) ;
}
if(TempRequest->RequestDescription.lpszAnomalyError != NULL)
{ strcat(TempRequest->lpszTotalDescription,",") ;
strcat(TempRequest->lpszTotalDescription,"ANOMALY=");
strcat(TempRequest->lpszTotalDescription,TempRequest->RequestDescription.lpszAnomalyError );
}
else
{ strcat(TempRequest->lpszTotalDescription,",");
}
if(TempRequest->RequestDescription.lpszChannelDescription!=NULL )
{ strcat(TempRequest->lpszTotalDescription,",") ;
strcat(TempRequest->lpszTotalDescription,TempRequest->RequestDescription.lpszChannelDescription);
}
else
{ strcat(TempRequest->lpszTotalDescription,",");
}
if(TempRequest->RequestDescription.lpszChannelNumber !=NULL )
{ strcat(TempRequest->lpszTotalDescription,",");
strcat(TempRequest->lpszTotalDescription,"Channel=");
strcat(TempRequest->lpszTotalDescription,TempRequest->RequestDescription.lpszChannelNumber);
}
else
{ strcat(TempRequest->lpszTotalDescription,",");
}
if(TempRequest->RequestDescription.lpszUnits != NULL)
{ strcat(TempRequest->lpszTotalDescription,",");
strcat(TempRequest->lpszTotalDescription,"Units=");
strcat(TempRequest->lpszTotalDescription,TempRequest->RequestDescription.lpszUnits);
}
else
{ strcat(TempRequest->lpszTotalDescription,",");
}
if( TempRequest->RequestDescription.lpszFilter !=NULL)
{ strcat(TempRequest->lpszTotalDescription,",");
strcat(TempRequest->lpszTotalDescription,"Filter=");
strcat(TempRequest->lpszTotalDescription,TempRequest->RequestDescription.lpszFilter);
}
else
{ strcat(TempRequest->lpszTotalDescription,",");
}
if(TempRequest->RequestDescription.lpszFileName != NULL )
{ strcat(TempRequest->lpszTotalDescription,",");
strcat(TempRequest->lpszTotalDescription,"File=");
strcat(TempRequest->lpszTotalDescription,TempRequest->RequestDescription.lpszFileName );
}
else
{ strcat(TempRequest->lpszTotalDescription,",");
}
strcat(TempRequest->lpszTotalDescription,"\0");

//Vectors
for(RowCount=1 ; RowCount <=ChannelLen ; RowCount++)
{
lpdDataObjChannelValueGet(Index,RowCount,&dValueT) ;
ActualValue = (float)dValueT ;
TempVector->lpDataValue[RowCount-1] = ActualValue ;
}

strcpy(TempVector->lpszVectorDescription,"---") ; //1) Vector description as a variable length string.
strcat(TempVector->lpszVectorDescription,"\0") ;
strcpy(TempVector->lpszVectorName,"---") ; //2) Vector name as a variable length string.
strcat(TempVector->lpszVectorName,"\0") ;
strcpy(TempVector->lpszEquation ,"\0") ; //3) Equation as a variable length string. I read but ignore this value.

TempVector->lNoOfPoints = ABFFile.GetChannelLength() ; //4) Number of points in vector as a four-byte integer.
TempVector->lNoOfBytes = 4 ; //5) Number of bytes in each point, either four or eight for single and double precision. The GM Safety Lab data uses single precision.
TempVector->lBinaryFlag = 1 ; //6) Binary flag as four-byte integer, always set to one.

TempRequest->lpVector = TempVector ;

//process data type details
LPDATA_TYPE Temp1 ;
Temp1= lpcDataType->FindDataType(TempDataType) ;
if(Temp1==NULL) //If Data Type node do not exist
{
TempDataType->lpRequest = TempRequest ;
lpcDataType->AppendDataType(TempDataType) ;
TotalNoOfRequest++;

}
else //If data type node already exist
{
Temp1->lNoOfRequests++ ;
lpcDataType->AppendRequest(TempRequest,Temp1);
TotalNoOfRequest++; //This number denotes total requests ir-respective of data types
}

Index ++ ;
if(Index>lChannelNos)
{
fclose(pTxtFile) ;
break ;
}
}
//}
//catch(...)
//{
// MessageBox((HWND)hDIAdemWndGet(),"Error while porting channels","Error",MB_OK);

//}

//HeaderInfo info
TDataSet DataSetT ; //Local Data Set parameter data structure
char Filename[25] ;
DataSetT.lSize = sizeof(TDataSet) ;

nDataSetGet(&DataSetT) ; //Call service routine to get Data set properties

ABFFile.SetTitle((char *)DataSetT.szDataSetTitle) ; // Get Title of Data Set
ABFFile.SetDateOfTest((char *)DataSetT.szDataSetDate); // Get the Data of Data Set


//These values are set arbitrarily for time being
ABFFile.SetTypeOfTest("Car to Car, 50% Offset") ;
ABFFile.SetTypeOfSubtest("Sub-Car to Car, 50% Offset");
ABFFile.SetRegulation("NOVALUE") ;
ABFFile.SetLabName("Lab Example") ;
ABFFile.SetLabContactName("Mr. Safety") ;
ABFFile.SetLabContactEmail("lab@example.com") ;
ABFFile.SetLabContactPhone("0123-450") ;

ABFFile.SetDescription() ; // to concat title, dateof test....

//Datermine No of data types & requests
ABFFile.SetNoOfDataTypes((long)lpcDataType->GetTotalDataTypes()); //for time being
ABFFile.SetNoOfRequests((long)TotalNoOfRequest) ;

strcpy(Filename,DataSetT.szDataSetTitle) ;
strcat(Filename,".th") ;
if (! ABFFile.FileOpen(Filename,"wb") )
return ; //in case of failure

ABFFile.WriteHeader() ;

//write all parts
for(int DataTypeNo=1;DataTypeNo<= lpcDataType->GetTotalDataTypes() ; DataTypeNo++)
//for(int ChannelCount=1;ChannelCount<=lChannelNos;ChannelCount++) // Channel Loop
{
LPDATA_TYPE TempDataType ; LPREQUEST TempRequest ; LPVECTOR TempVector ;
TempDataType = lpcDataType->GetDataType(DataTypeNo) ;

//Write data type data
StringLen = strlen(TempDataType->lpszDataTypeDescription);
ABFFile.Write(&StringLen,1,2) ;
ABFFile.Write(TempDataType->lpszDataTypeDescription,1,strlen(TempDataType->lpszDataTypeDescription));

StringLen = strlen(TempDataType->lpszDataTypeName);
ABFFile.Write(&StringLen,1,2) ;
ABFFile.Write(TempDataType->lpszDataTypeName,1,strlen(TempDataType->lpszDataTypeName)) ;

ABFFile.Write(&TempDataType->lDefaultTimeDataType,1,4);
ABFFile.Write(&TempDataType->lNoOfRequests,1,4);
ABFFile.Write(&TempDataType->lNoOfComponents,1,4 );

TempRequest = TempDataType->lpRequest ;
while(TempRequest !=NULL)
{
//write Request data
StringLen = strlen(TempRequest->lpszTotalDescription);
ABFFile.Write(&StringLen,1,2);
ABFFile.Write(TempRequest->lpszTotalDescription ,1,(unsigned int)StringLen);
//ABFFile.Write("\n",1,1);

StringLen = strlen(TempRequest->lpszRequestName);
ABFFile.Write(&StringLen,1,2);
ABFFile.Write(TempRequest->lpszRequestName,1,(unsigned int)StringLen) ;
//ABFFile.Write(",",1,1);
//ABFFile.Write("\n",1,1);

StringLen = strlen(TempRequest->lpszRequestNameRe);
ABFFile.Write(&StringLen,1,2);
ABFFile.Write(TempRequest->lpszRequestNameRe,1,(unsigned int)StringLen) ;
//ABFFile.Write(",",1,1);
//ABFFile.Write("\n",1,1);

TempVector = TempRequest->lpVector ;

//write vector details
StringLen =strlen(TempVector->lpszVectorDescription) ;
ABFFile.Write(&StringLen,1,2);
ABFFile.Write(TempVector->lpszVectorDescription,1,3);

StringLen = strlen(TempVector->lpszVectorName);
ABFFile.Write(&StringLen,1,2);
ABFFile.Write(TempVector->lpszVectorName,1,3);

StringLen =strlen(TempVector->lpszEquation) ;
ABFFile.Write(&StringLen,1,2);
ABFFile.Write(TempVector->lpszEquation,1,StringLen);

StringLen =TempVector->lNoOfPoints ;
ABFFile.Write(&StringLen,1,4);

StringLen = TempVector->lNoOfBytes ;
ABFFile.Write(&StringLen,1,4);

StringLen = TempVector->lBinaryFlag ;
ABFFile.Write(&StringLen,1,4);

StringLen = TempVector->lNoOfBytes * TempVector->lNoOfPoints ;
ABFFile.Write(TempVector->lpDataValue,1,StringLen);

TempRequest = TempRequest->NextRequest ;
}

}
//MessageBox((HWND)hDIAdemWndGet(),"End Of Porting Channels","End",MB_OK) ;
ABFFile.FileClose() ;
delete lpcDataType ;

}
else
{
MessageBox((HWND)hDIAdemWndGet(),"The Channels do not contain data, Conversion to ABF will be stopped!!!","Abort",MB_OK) ;
}
return ;
}
GeneralRe: Dll Error: Debug assertion failed? Pin
David Crow5-Dec-05 2:48
David Crow5-Dec-05 2:48 
QuestionVC++ 6.0 editor and line numbers Pin
Ahsan Askare1-Dec-05 1:36
Ahsan Askare1-Dec-05 1:36 
AnswerRe: VC++ 6.0 editor and line numbers Pin
David Crow1-Dec-05 4:45
David Crow1-Dec-05 4:45 
GeneralRe: VC++ 6.0 editor and line numbers Pin
Ahsan Askare1-Dec-05 17:21
Ahsan Askare1-Dec-05 17:21 
GeneralRe: VC++ 6.0 editor and line numbers Pin
David Crow2-Dec-05 3:27
David Crow2-Dec-05 3:27 
Questioncolorref Pin
Dody_DK1-Dec-05 1:27
Dody_DK1-Dec-05 1:27 
AnswerRe: colorref Pin
Cedric Moonen1-Dec-05 2:24
Cedric Moonen1-Dec-05 2:24 
GeneralRe: colorref Pin
Maximilien1-Dec-05 2:28
Maximilien1-Dec-05 2:28 
GeneralRe: colorref Pin
Cedric Moonen1-Dec-05 2:36
Cedric Moonen1-Dec-05 2:36 
GeneralRe: colorref Pin
toxcct1-Dec-05 3:11
toxcct1-Dec-05 3:11 
GeneralRe: colorref Pin
Dody_DK1-Dec-05 2:43
Dody_DK1-Dec-05 2:43 
GeneralRe: colorref Pin
Cedric Moonen1-Dec-05 2:55
Cedric Moonen1-Dec-05 2:55 
GeneralRe: colorref Pin
Dody_DK1-Dec-05 11:10
Dody_DK1-Dec-05 11:10 
GeneralRe: colorref Pin
Cedric Moonen1-Dec-05 20:31
Cedric Moonen1-Dec-05 20:31 
GeneralRe: colorref Pin
Dody_DK1-Dec-05 23:42
Dody_DK1-Dec-05 23:42 
Questionproblem with DirectSound appllication Pin
8ki1-Dec-05 0:30
8ki1-Dec-05 0:30 
QuestionIdentifying the interactive user Pin
Krishnan V30-Nov-05 23:55
Krishnan V30-Nov-05 23:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.