link

vi main1.cpp
#include <iostream>
#include <fstream>
#include <stdio.h>

using namespace std;
int main()
{
    ifstream inFile("test.txt", ios::in);


    //printf("%p",inFile);
    cout<<"inFile="<< !inFile<<endl;
    if (inFile)
        inFile.close();
    else
        cout << "test.txt doesn't exist" << endl;
    ofstream oFile("test1.txt", ios::out);
    if (!oFile)
        cout << "error 1";
    else
        oFile.close();
    fstream oFile2("./test2.txt", ios::out | ios::in);
    if (!oFile2)
        cout << "error 2";
    else
        oFile.close();
    return 0;
}
g++ -g main1.cpp -o main
gdb main
b 8
r 
n
p inFile 
print (void *)inFile
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from main...done.
(gdb) b 8
Breakpoint 1 at 0xef5: file main1.cpp, line 8.
(gdb) r 
Starting program: /home/ledi/cc/4/main 

Breakpoint 1, main () at main1.cpp:8
8	    ifstream inFile("test.txt", ios::in);
(gdb) n
13	    if (inFile)
(gdb) p inFile 
$1 = <incomplete type>
(gdb) print (void *)inFile
$2 = (void *) 0x7ffff7dc9410 <vtable for std::basic_ifstream<char, std::char_traits<char> >+24>