472,363 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,363 software developers and data experts.

save an object

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.

Jul 22 '05 #1
9 1490
* danny van elsen:
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?
Jul 22 '05 #2
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

Jul 22 '05 #3
On 18 Dec 2004 04:15:51 -0800 in comp.lang.c++, "EventHelix.com"
<ev********@gmail.com> wrote,
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.

Jul 22 '05 #5
"danny van elsen" <da*************@hotmail.com> wrote in message
news:pa****************************@hotmail.com...
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.
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).
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.
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
Jul 22 '05 #6
tanx!

On Sat, 18 Dec 2004 05:24:38 -0800, matej.kovac wrote:
http://www.parashift.com/c++-faq-lit...alization.html


Jul 22 '05 #7
> 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?
Jul 22 '05 #8
danny van elsen wrote:
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-lit...alization.html
Jul 22 '05 #9

"danny van elsen" <da*************@hotmail.com> wrote in message
news:pa****************************@hotmail.com...
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. :-) Careful
what you ask for...some joker just might give it to you!

Jul 22 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml...
7
by: Shanli RICHEZ | last post by:
I'm using ASP.NET and quite a lot of object in memory instead of a database. The question is that I tried to save the data, serialize them in a XML file to save them when the application is...
10
by: GJP | last post by:
Hello. Ive been asked to make my own notepade for college assignment. All ig going well, but i cant get the save to work. I can get Save a (shows dialog box), i can get it to just save too,...
4
by: jmhmaine | last post by:
The following code works when Option Strict is off: Dim thumbSize As New Size thumbSize = CType(NewthumbSize(g.Width, g.Height, 100), System.Drawing.Size) Dim imgThumbOutput As New Bitmap(g,...
2
by: zheng | last post by:
I have a word document and it has a picture object, I want save the picture object as other single picture file by C# program. I have a idea, by clipboard, copy the picture to clipboard, and...
1
by: Rocco | last post by:
I have a single Excel workbook stored as an OLE object in an Access table. I am trying to figure out how to save this object as an .xls file, open it, modify it, and resave it. I know how I can...
1
by: liuliuliu | last post by:
hi -- sorry if this is trivial -- but how do you make a screenshot of a pygame display? i have a surface which is basically the entire visible screen -- how do you write this surface as an image...
13
by: Joe | last post by:
does anyone know why this source code throws an error?? Dim myBitmap As System.Drawing.Bitmap Dim myGraphics As Graphics myBitmap = New System.Drawing.Bitmap(fileName:="C:\test.tif")...
0
by: ppardi | last post by:
I'm developing an addin for Word 2007 and I need to determine whether a user saves a Word 2007 document in an older format (97-2003) after a save as is done. The scenario is that the user starts...
0
by: phanibiddu | last post by:
How to draw on windows form and save it as Jpeg file I am trying with this code but not comming public Form3() { InitializeComponent(); //rnd = new...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
1
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
0
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.