473,407 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 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 1573
* 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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.