I'm not sure if you really would want to use a .dat file extension, since it usually uses a certain unreadable (to humans) code:
So instead you might want to use a .txt file extension instead, but you don't have to since a user-created data file can have plain text with no problems.
Anyway, you might want to try to make this in python first, then follow up with C or C++ to get an idea of what to do.
:)