Passing structures to a function
I have a class that contains a vector of structs. I want to pass each of the structs in the array to a function one by one. I get a run-time assertion error.
Here are important (I think) bits of the code
Code:
// function that uses the struct:
int MakeArincWordAnalog(DataLine *Line, float value, int word)
{
int number;
word =0;
FILE *out;
out = fopen("Victor - test.txt", "w");
fprintf(out, ">%s %d %d %d %d %d %d %d\n<", Line->Param, Line->Label,
Line->SFactor, Line->SigBits, Line->Bit30,
Line->Bit31, Line->Max, Line->Min);
// The function call in main:
MakeArincWordAnalog(&FAD.vectDL[i], mtxVicVals[j][i], TempWord);
// the struct and class declarations:
struct DataLine
{
char Param[20];
int Label, SFactor, SigBits;
int Bit30, Bit31, Max, Min;
DataLine()
{
Label=SFactor=SigBits=Bit30=Bit31=Max=Min=0;
memset(Param, 0, sizeof(Param));
};
} ;
class FSAD //Fixed/Selectable Analog Data
{
public:
char Name[25];
int nExpected; // size = nExected*2+1
std::vector < DataLine > vectDL;
};
The code doesn't seem to like the way I pass it the struct.