BorlandDave
Programmer
I have some code to edit which I don't fully understand. Here it is...
struct TDelrecs_tbl{
int table_no;
int pk1, pk2;
};
void function1(void){
TDelrecs_tbl delrec;
delrec.table_no=1;
delrec.pk1=2;
delrec.pk2=3;
function2(&delrec);
}
void function2(void *dbstruct){
pFile = fopen("C:\\DAVE_function2.txt","a+");
fprintf(pFile,"%i,%i,%i\n",dbstruct.table_no,dbstruct.pk1,dbstruct.pk2);
fclose(pFile);
}
I'm just trying to write out the variables of the struct to a file in the second function. The way the struct is passed between functions can't be changed. Can anyone make this work? Cheers.
struct TDelrecs_tbl{
int table_no;
int pk1, pk2;
};
void function1(void){
TDelrecs_tbl delrec;
delrec.table_no=1;
delrec.pk1=2;
delrec.pk2=3;
function2(&delrec);
}
void function2(void *dbstruct){
pFile = fopen("C:\\DAVE_function2.txt","a+");
fprintf(pFile,"%i,%i,%i\n",dbstruct.table_no,dbstruct.pk1,dbstruct.pk2);
fclose(pFile);
}
I'm just trying to write out the variables of the struct to a file in the second function. The way the struct is passed between functions can't be changed. Can anyone make this work? Cheers.