JohanErlank
Programmer
Hi
I am trying the following:
file.h:
typedef struct
{
int iBit;
void (*save_fun)(void);
} __save_rec;
...
#define MAXRECS 20
class TForm1 : public TForm
{
__published:
..
private:
__save_rec SaveData[MAXRECS];
void SavPan(void);
void SavAmt(void);
void SavFD7(void);
void __fastcall FillArray();
void __fastcall ExecFun(int iVal);
public:
...
};
...
file.cpp:
...
void __fastcall TForm1::FillArray()
{
SaveData[0].iBit=0;
SaveData[0].save_fun=SavPan;
...
}
void __fastcall TForm1::StepVals(void)
{
for (int i=0;i<10;i++)
{
ExecFun(i);
}
}
void __fastcall TForm1::ExecFun(int iVal)
{
if(iVal==SaveData[iVal].iBit)
SaveData[iVal].save_fun();
}
but it does not work. I get all kinds of errors. I have done this in standard C, no problem, but as I am new to c++ (especially Builder)I have no idea on how to get this done.
Any ideas or pointers on how to get something like this done?
Thanks!
Johan
I am trying the following:
file.h:
typedef struct
{
int iBit;
void (*save_fun)(void);
} __save_rec;
...
#define MAXRECS 20
class TForm1 : public TForm
{
__published:
..
private:
__save_rec SaveData[MAXRECS];
void SavPan(void);
void SavAmt(void);
void SavFD7(void);
void __fastcall FillArray();
void __fastcall ExecFun(int iVal);
public:
...
};
...
file.cpp:
...
void __fastcall TForm1::FillArray()
{
SaveData[0].iBit=0;
SaveData[0].save_fun=SavPan;
...
}
void __fastcall TForm1::StepVals(void)
{
for (int i=0;i<10;i++)
{
ExecFun(i);
}
}
void __fastcall TForm1::ExecFun(int iVal)
{
if(iVal==SaveData[iVal].iBit)
SaveData[iVal].save_fun();
}
but it does not work. I get all kinds of errors. I have done this in standard C, no problem, but as I am new to c++ (especially Builder)I have no idea on how to get this done.
Any ideas or pointers on how to get something like this done?
Thanks!
Johan