How would I find that out? Its a very basic file of a frequency wave and a few text saved as a ".dat".
Open it in a HEX editor? (or text editor if it's a text based file?) Or consult the file format spec? Swiftcoder is right. Effectively you have a data-structure, albeit one that's been serialized to disk. The structure of your data will, to a large extent, influence how relevant or applicable the advice we give will be. This returns the contents of any file as a string:
[source]
std::string loadFile(const char* filename)
{
std::string p;
std::FILE* fp = std::fopen(filename, "rb");
if(fp)
{
std::fseek(fp, 0, SEEK_END);
size_t s = std::ftell(fp);
if(s)
{
std::fseek(fp, 0, SEEK_SET);
p.resize(s);
std::fread(&p[0], 1, s, fp);
}
std::fclose(fp);
}
return p;
}
[/source]
Now, you wouldn't actually want to use that. Probably. Maybe. Possibly. Who the hell knows? Take the gamble? Phone a friend? I don't know, nor does anyone else.
To use a car analogy: The above code gives permission for a passenger to open a car door. Swiftcoder is merely asking what your passengers will find beyond that door. Will they find that the car is stationary? Will they find the ground rushing past them at 70mph? Will they find that the car has actually been compressed, in a vice, and that the doors cannot open?
How you tackle problems of this sort are 'usually' formulaic. I'm happy to step onto tarmac that isn't moving, less enthusiastic when it's moving at speed (stop first!), and would like to know whether I should keep my mobile on me, just in case someone tries to squish me in a vice.