I am trying to debug a program and need to find out the name of the fstream that the program is opening. Every time I cout the fstream, it give me the address instead of the filename. I have tried everything I know. How can I cout the filename instead of the address????
Post some code... you description is vague at best.
Best guess: print the filename variable, not the fstream object.
I'm sorry, I forgot that information.
Compiler: MingW/GCC 3.2
Platform: Dev-C++ Version 184.108.40.206
OS: Windows XP
Here is a small sample:
I know that class_name is supposed to be the filename, but I was wanting to debug to be for certain what filename was stored in data. Because when this section of code runs, the "file did not open" line runs and at the time there is a file of that name that does exist in the directory. How do I print out the filename in data. And I have tried to store data's contents in a string, but it will not let me make the conversion.
void read_data(string ID,istream& in)
int counter = 0;
for (int j=0;j<1;j++)
if (! data.is_open())
cout<<" file did not open"<< data;
cout<<" file did open"<< data;
Thanks for the reply.
Any info will be greatly appreciated.