Saving program data

I'm looking for information and some history. I am writing a program and I want to save some data without using a database. I assume I can use XML, but what else can I use? How do you store data in files and then retrieve it without XML and without plain text? What is binary formatting, can it be used? Isn't binary formatting what Microsoft used for Office files? I'm not sure how to do this and would appreciate any help, thanks.

0


source to share


5 answers


"Binary formatting" is a rather vague term. Basically it is "nothing but plain text formatting".

You can choose any format you want to burn to disc. If you use an existing format (XML, ini-file, Protocol Buffers, Thrift, etc.), you get the existing code from it to write / parse data. If you write your own format, you can adapt it to your specific requirements.



This issue was discussed in another question .

+1


source


Why avoid the database? If it's just overhead, did you consider sqlite ?



+2


source


What data are you trying to save? And is there any reason to avoid plain text, XML and databases? I can understand that you are avoiding databases as you may not need to deal with the overhead, and if you are referring to storing information, akin to a Word file, then it makes no sense to use anything other than a flat file (unless you are "working on web application, in which case I return that expression).

What development platform are you using? In Java, you can use FileReader and FileWriter to read and write files. If you want to format the files before creating them, you can write a way to do this. Other languages ​​will have similar functionality, just search for "read and write files in languageX".

+1


source


I am using C #. I'm probably going to use XML, but I was just learning and wanted to know some alternatives. Basically, I wanted my program to be like a program like Office where you add something and then save it to a file for later retrieval. If you look at the Office file in a text editor, everything is garbled and I think it is binary. When you upload a file, is it just pulling in information and storing it in a collection or something?

0


source


Blockquote "Binary formatting" is a rather vague term. Basically it is "nothing but plain text formatting". You can choose any format you want to burn to disc. If you use an existing format (XML, ini-file, Protocol Buffers, Thrift, etc.), you get the existing code from it to write / parse data. If you write your own format, you can adapt it to your specific requirements.

Interesting, so I thought. There are pre-existing formats, such as obviously XML, but you can also use others or create your own. Do you happen to know what is commonly used before XML or do most large companies just write themselves? I find it very difficult to write my own

0


source







All Articles