#include <iostream>
#include <fstream>
using namespace std;
int main()
{
string asegurado;
cout << "Nombre a agregar: ";
cin >> asegurado;
ofstream entrada(asegurado,"");
if (entrada.fail())
{
cout << "El archivo no se creo correctamente" << endl;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnN0cmVhbT4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpCnsgCnN0cmluZyBhc2VndXJhZG87CmNvdXQgPDwgIk5vbWJyZSBhIGFncmVnYXI6ICI7CmNpbiA+PiBhc2VndXJhZG87Cgogb2ZzdHJlYW0gZW50cmFkYShhc2VndXJhZG8sIiIpOwppZiAoZW50cmFkYS5mYWlsKCkpCnsKICAgIGNvdXQgPDwgIkVsIGFyY2hpdm8gbm8gc2UgY3JlbyBjb3JyZWN0YW1lbnRlIiA8PCBlbmRsOwp9Cn0gICAgICA=
prog.cpp: In function 'int main()':
prog.cpp:12:31: error: no matching function for call to 'std::basic_ofstream<char>::basic_ofstream(std::string&, const char [1])'
ofstream entrada(asegurado,"");
^
In file included from prog.cpp:2:0:
/usr/include/c++/5/fstream:725:7: note: candidate: std::basic_ofstream<_CharT, _Traits>::basic_ofstream(std::basic_ofstream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]
basic_ofstream(basic_ofstream&& __rhs)
^
/usr/include/c++/5/fstream:725:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/5/fstream:715:7: note: candidate: std::basic_ofstream<_CharT, _Traits>::basic_ofstream(const string&, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::string = std::basic_string<char>; std::ios_base::openmode = std::_Ios_Openmode]
basic_ofstream(const std::string& __s,
^
/usr/include/c++/5/fstream:715:7: note: no known conversion for argument 2 from 'const char [1]' to 'std::ios_base::openmode {aka std::_Ios_Openmode}'
/usr/include/c++/5/fstream:697:7: note: candidate: std::basic_ofstream<_CharT, _Traits>::basic_ofstream(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::_Ios_Openmode]
basic_ofstream(const char* __s,
^
/usr/include/c++/5/fstream:697:7: note: no known conversion for argument 1 from 'std::string {aka std::basic_string<char>}' to 'const char*'
/usr/include/c++/5/fstream:682:7: note: candidate: std::basic_ofstream<_CharT, _Traits>::basic_ofstream() [with _CharT = char; _Traits = std::char_traits<char>]
basic_ofstream(): __ostream_type(), _M_filebuf()
^
/usr/include/c++/5/fstream:682:7: note: candidate expects 0 arguments, 2 provided