C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

save an object

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
danny van elsen
Guest





PostPosted: Sat Dec 18, 2004 11:55 am    Post subject: save an object Reply with quote



hello all,

in my application, I want to save an object to a file: what would be
the best way to do this?

binary or text?
self written or existing library?

thanks for any answer,
Danny.

Back to top
Alf P. Steinbach
Guest





PostPosted: Sat Dec 18, 2004 11:57 am    Post subject: Re: save an object Reply with quote



* danny van elsen:
Quote:
hello all,

in my application, I want to save an object to a file: what would be
the best way to do this?

binary or text?
self written or existing library?

thanks for any answer,

Well, you might check out Niels Bohr's answer to the question: "How
many tails does a dog have?".

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Back to top
EventHelix.com
Guest





PostPosted: Sat Dec 18, 2004 12:15 pm    Post subject: Re: save an object Reply with quote



If it is a windows application, you have two options:

- Use the built in serialization support in MFC. Fairly complicated
objects containing
arrays/lists of objects can be saved.

- Use the XmlSerializer for .NET applications. Your objects will be
saved in XML.

Deepa
--
http://www.EventHelix.com/EventStudio
EventStudio 2.5 - Generate sequence diagrams from plain text input

Back to top
matej.kovac@gmail.com
Guest





PostPosted: Sat Dec 18, 2004 1:24 pm    Post subject: Re: save an object Reply with quote

RTFW! http://www.parashift.com/c++-faq-lite/serialization.html

Back to top
David Harmon
Guest





PostPosted: Sat Dec 18, 2004 6:53 pm    Post subject: Re: save an object Reply with quote

On 18 Dec 2004 04:15:51 -0800 in comp.lang.c++, "EventHelix.com"
<eventhelix (AT) gmail (DOT) com> wrote,
Quote:
If it is a windows application, you have two options:

Oh come on! Those two are just the options you have _only_ on a
windows platform, in addition to all the many platform-independent
options you could use without selling your soul^W^W^W^W.

The first thing I would look at is the Boost serialization library.


Back to top
Mike Wahler
Guest





PostPosted: Sat Dec 18, 2004 9:14 pm    Post subject: Re: save an object Reply with quote

"danny van elsen" <danny_van_elsen (AT) hotmail (DOT) com> wrote

Quote:
hello all,

in my application, I want to save an object to a file: what would be
the best way to do this?

"Best" depends upon context and opinion.

Quote:
binary or text?

Text will be more portable. Binary will constrain use
to a specific platform/implementation (or 'category'
of them). The 'trade-off' is that binary can often
have better performance than text (the 'footprint'
will usually be smaller).

Quote:
self written

Self-written is always an option. It has the advantage
that it you can make it work exactly how you want, and
you can modify it at will.

Quote:
or existing library?

Existing libraries can save large amounts of time and effort,
but sometimes might restrict you more than you'd like (though
many libs come with source, and if you understand it, you
could change it -- but often this imposes usage restrictions)

If you're looking for a 'get it done as quickly as possible'
solution, try to find a library that does what you need.
If you can't, you could try modifying a library or creating
your own.

If your motivation is learning, or functionality for which
you can't find a library, or perhaps simply 'for fun', try
writing it yourself.

IMO the most pertinent question to ask yourself when determining
how to serialize data, is "how/when/where will this data need
to be accessed?"

HTH,
-Mike



Back to top
danny van elsen
Guest





PostPosted: Sun Dec 19, 2004 10:11 pm    Post subject: Re: save an object Reply with quote

tanx!

On Sat, 18 Dec 2004 05:24:38 -0800, matej.kovac wrote:

Quote:
http://www.parashift.com/c++-faq-lite/serialization.html


Back to top
danny van elsen
Guest





PostPosted: Mon Dec 20, 2004 9:26 pm    Post subject: Re: save an object Reply with quote

Quote:
Well, you might check out Niels Bohr's answer to the question: "How
many tails does a dog have?".

does it involve talking chinese to people?

Back to top
E. Robert Tisdale
Guest





PostPosted: Mon Dec 20, 2004 9:52 pm    Post subject: Re: save an object Reply with quote

danny van elsen wrote:

Quote:
In my application, I want to save an object to a file.
What would be the best way to do this?

I used Google

http://www.google.com/

to seach for

+"C++" +"serialization"

and I found lots of stuff including

http://www.parashift.com/c++-faq-lite/serialization.html

Back to top
Howard
Guest





PostPosted: Mon Dec 20, 2004 10:04 pm    Post subject: Re: save an object Reply with quote


"danny van elsen" <danny_van_elsen (AT) hotmail (DOT) com> wrote

Quote:
Well, you might check out Niels Bohr's answer to the question: "How
many tails does a dog have?".

does it involve talking chinese to people?

No, but it is "any answer", which is what you thanked us for. Smile Careful
what you ask for...some joker just might give it to you!




Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.