Question:
Programming a tax program and user file?
Ryan
2008-03-20 11:16:09 UTC
Say you are programming a program to do tax returns. The user will save a file with all the person's info (like income etc).

If you open a commercial package userfile with say Notepad, you'll see a lot of garbage (like hex).

How do commercial software vendors tend to format such files? It seems they don't use a database but rather store as hex or binary or something?
Three answers:
Robert S
2008-03-20 11:24:21 UTC
In one word -- Encryption



Encryption is a method of scrambling data so that only someone who possesses the appropriate password or “key” can access the information. Encryption can be a confusing subject because there are so many different types of encryption that can be used to protect data. Currently, the most desirable type of encryption is called AES (Advanced Encryption Standard). AES encryption is available in different strengths, expressed in “bits”—the more bits, the stronger the encryption. The current US government standard for data encryption is 256-bit AES encryption.
anonymous
2008-03-20 19:44:28 UTC
Most software slams around the data with binary. It makes sense then to do the I/O (the file read/write) in binary. It's faster. After we've learned in CIS to read and write to files, then comes the next problem. I have a line of data read from a file... how do I split that line?



There are various schemes in programming. One scheme is called flat-file. You can export an Excel worksheet as comma-delineated and that is a "flat-file". Flat file works good if in every line of data, every time, field 3 is say, a phone number. But to be more flexible than flat-file, we have to use identity for each field so that in such a data structure, the phone number would not have to be field 3 each time. That's where you see hex-codes.



To get even more elaborate, I detest the Microsoft .doc format for Word. Microsoft writes files with a huge preamble to save "history" info about that document. The doc format was made to do UnDo. So, when a book writer is using the doc format making a big book, there is a pretty good chance the doc won't open one day after a lot of edits.



Rarely is encryption used for data generated in a program.



A database is another world separate from code-monkey. My above explanation refers to what a code-monkey would contrive. Database usually lets us work with the raw data if need be.
anonymous
2008-03-20 19:53:33 UTC
If you're asking how programs save data in a general sense (not encrypted), it's usually just the way the data sits in the computer. Saving the number 12345.67890 to a file won't save those digits, it'll save the number as it sits in the computer's memory, which is a floating point format. Other types of data also don't always sit in the computer the way you see them on the screen.



There's no "formatting" involved - if you save a date in Excel, it save as a floating point number, the number of days since Dec, 31, 1899 to the left of the decimal and the percentage of a day (the "time") to the right. (Excel "formats" it into the form you see in the program.) Add the fact that a floating point number doesn't always sit the way you see it, and it's very different than what you expect, but exactly what the computer expects.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...