In C++ on MS Windows XP. Actually using MS Visual C++ in VS 2003 .net (v7.1) and VS 2005, on XP Pro with SP2.

How can I find the full pathname which is attached to a file stream?

I have code like:

bool DataModel::readGrades(char* filename)
  std::ifstream tablestream(filename);
  if (!tablestream)
    Error("Couldn't open alloy grades data file %s", filename);
    return false;

where the given filename is usually a relative filename. In practice, our users often have multiple sets of data they are swapping between, and sometimes they get confused about which is which, so we would like to be able to print out the full explicit path of the file that their relative filename translates into. It would make tracking down mistakes far easier.

I have trawled various sites, FAQs, MSDN etc and can't see how to do this. The info must be there somewhere because the streams do connect with real files.

Hope somebody can help as this sounds like it should be so simple.