billclinton6
asked on
Dumping content of object to a file/screen
I have a class called 'EquSol' like
class EquSol
{
private:
int m_CurrentOffset;
EquVar* m_Result;
EquEquation** m_Equations;
}
and I am using
EquSol Obj;
I would like to dump the content of 'Obj' to a file so I am
thinking of adding a public method to class 'EquSol', that will
take input as object and dump its content to screen/file.
Any idea how to do this?
class EquSol
{
private:
int m_CurrentOffset;
EquVar* m_Result;
EquEquation** m_Equations;
}
and I am using
EquSol Obj;
I would like to dump the content of 'Obj' to a file so I am
thinking of adding a public method to class 'EquSol', that will
take input as object and dump its content to screen/file.
Any idea how to do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
just a thought
public:
void dump(ostream& out, int nlevel)
{
switch(nlevel)
{
case 1: out << m_CurrentOffset;
...
break; // dump our own data
case 2: out << m_CurrentOffset;
m_Result->dump(out, 1);
break; // ask aggregates to dump their data
case 3: out << m_CurrentOffset;
m_Result->dump(out, 3);
break; // full dump
};
}
public:
void dump(ostream& out, int nlevel)
{
switch(nlevel)
{
case 1: out << m_CurrentOffset;
...
break; // dump our own data
case 2: out << m_CurrentOffset;
m_Result->dump(out, 1);
break; // ask aggregates to dump their data
case 3: out << m_CurrentOffset;
m_Result->dump(out, 3);
break; // full dump
};
}
hey bill! If that doesn't help, maybe i can think of some way to be of service.
We have seperated you two before, I have done it myself this time. :>
ComTech
CS Admin @ EE
See ya Monica
ComTech
CS Admin @ EE
See ya Monica
Would you mind to shed in some light, ComTech? :o)
The monica account is a joke, since this users name is bill clinton.
The Monica account is on hold.
The Monica account is on hold.
Well, I did notice that - I thought I was missing something else :o)
Thanx!
Thanx!
Please update and finalize this old, open question. Please:
1) Award points ... if you need Moderator assistance to split points, comment here with details please or advise us in Community Support with a zero point question and this question link.
2) Ask us to delete it if it has no value to you or others
3) Ask for a refund so that we can move it to our PAQ at zero points if it did not help you but may help others.
EXPERT INPUT WITH CLOSING RECOMMENDATIONS IS APPRECIATED IF ASKER DOES NOT RESPOND.
Thanks,
** Mindphaser - Community Support Moderator **
P.S. Click your Member Profile, choose View Question History to go through all your open and locked questions to update them.
1) Award points ... if you need Moderator assistance to split points, comment here with details please or advise us in Community Support with a zero point question and this question link.
2) Ask us to delete it if it has no value to you or others
3) Ask for a refund so that we can move it to our PAQ at zero points if it did not help you but may help others.
EXPERT INPUT WITH CLOSING RECOMMENDATIONS IS APPRECIATED IF ASKER DOES NOT RESPOND.
Thanks,
** Mindphaser - Community Support Moderator **
P.S. Click your Member Profile, choose View Question History to go through all your open and locked questions to update them.
Maybe I'm not a joke but billclinton6 is. Hard to tell, don't you think?
Dear billclinton6
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity, I will suggest to accept
"jkr"
comment(s) as an answer.
If you think your question was not answered at all, you can explain here why you want to do this and post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: https://www.experts-exchange.com/commspt/
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity, I will suggest to accept
"jkr"
comment(s) as an answer.
If you think your question was not answered at all, you can explain here why you want to do this and post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: https://www.experts-exchange.com/commspt/
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
Force accepted
** Mindphaser - Community Support Moderator **
** Mindphaser - Community Support Moderator **
class EquSol
{
void Dump(ostream& out);
private:
int m_CurrentOffset;
EquVar* m_Result;
EquEquation** m_Equations;
}
void EquSol::Dump(ofstream& out)
{
out << "m_CurrentOffset" << m_CurrentOffset;
....
}
main()
{
EquSol obj;
obj.Dump(cout);
obj.Dump(file);
}