You're looking to make a REALLY long program. First: A program can't possibly be compatable on every concieveable machine/compiler, its just not possible without making it unessesarily long. It woul have to sense the OS and use conditional statements to operate under it. I would save that kind of thing for if your actually making somthing a lot of people will use.
2nd: Writing data into binary files is no different than writing it into any other file type unless it's encrypted. You can write data into a binary, and read it with notepad and see everything, even though it was saved useing a binary output.
Now, there really is no "proper" way to store data. You store data based on it's purpose, and necessity. The best way to store data is by sorting it. This is more commonly reffered to as a Data Structure. A data structure is ANY data that is sorted. a good example:
I wrote a program which allows the user to create a budget. To do this, we need the data:
Item, cost, Description(optional), time it was modified, and group.
We sort this so that it is easier to retrieve. I used a "line" type of structure. I basically put each piece of data on a line in the file in an order.
1 2 3 4 5
|
Item
cost
description
time
group
|
So, if I wanted to (lets just say) get the name of every Item in that file, i would put all the data into a vector, close the file, get every 5th line in the vector(starting with the 0th), and put each one into a new vector so we can easily do whatever we want with those names (like display them in a menu).
So, as you can see, it really doesnt matter, as long as the data is "formatted" (or sorted) in a way thats easily retriev-able by your program. The reason we do this, btw is to save space. Why make a file for each item in my budget, when I can just put all that data into 1 file?
You really just have to start trying it out.
I guess a good example of a "Serialization" I am emplementing for my budget program is (sort of) like a loader. It will perform the following task(s):
1. Get the current month and year
2. Check all the months/years of out items
3. store out-dated item_names in a vector
4. if vector.size() > 0, prompt the user to save the data to an archive
This is so that we wont have to delete all the items when the next month arrives. I made it optional, so that if you want to look at or save some of that information you can. I'm also going to add in the additional option of saveing an expense report, as I already have it displaying it in the program it will be easy to do.
Really all "Serialization" is, is making your program retrieve data relavant to it's operation on startup.
I also think you may be over-reacting with all this "compiler differences" and "padding differences". You're going to write the program on only 1 compiler, so it doesnt matter if your program cant compile with another comiler. Binary is Binary, no matter what program translates your C++. And integers having different sizes? It's an INCREDIBLY small difference. I would only worry about that if you were going to include an array of 1000 longs in your program.
So, just go man. Make the program.