Mail Archives: djgpp/1998/08/27/19:07:22
> 1. How may I copy one structure over another? Example: Given
> default(a struct) and current(a struct of the same type) can a simply say
> current=default? Or is that a BAD thing to do?
That is fine. It will just make a binary copy of the data in the struct.
> 2.How may I compare the contents of two structures find out which
> fields differ between them? IE given current and default, I want to know
> that settings.a is different? Is there a way to do to that easier than
> comparing each field?
This should explain it:struct A
{
int a, b;
};
int operator == (A& LVal, A& RVal)
{
return (LVal.a==RVal.a) && (LVal.b==RVal.b);
}
int main()
{
A t1,t2;
t1=t2;
if(t1==t2) return 1;
return 0;
}
> 3. I know that C and C++ files can be compiled and then linked
> together to form one *.exe file. Is that good form?
Why not just compile them all as C++ files, there are only very few cases
where C code won't compile correctly as C++ code.
--
(\/) Endlisnis (\/)
s257m AT unb DOT ca
Endlisnis AT GeoCities DOT com
Endlis AT nbnet DOT nb DOT ca
- Raw text -