I have to call backtrace_symbols_fd() function, but the third argument of this function is file descriptor.
so can i pass that third argument as ofstream object ?
I’m tyring following code:
ofstream myfile;
myfile.open ("example.txt");
size_t size = backtrace(aray, 5000);
backtrace_symbols_fd(aray, 5000, myfile);
But with above function call im getting following error:
cannot convert 'std::ofstream' to 'int' for argument '3' to
'void backtrace_symbols_fd(void* const*, int, int)'
As you have discovered, no it is not possible to pass an
ofstream.Just use the
open(2)function to get a file descriptor.