Código
#include <iostream> #include <fstream> using namespace std; class Fichero{ ofstream Datos; public: void Ingresar(); }; void Fichero::Ingresar(){ this->Datos.open("Rojo.txt"); cout<<"Dame algunas frases."<<endl; string f; cin.getline(f,100); Fichero >> f; } int main(){ Fichero Edgar; Edgar.Ingresar(); return 0; }
y los errores que me manda son estos.
Código
||=== Build file: "no target" in "no project" (compiler: unknown) ===| C:\Users\Edgar\Desktop\ArchivosC++\Ejercicio6.1.cpp||In member function 'void Fichero::Ingresar()':| C:\Users\Edgar\Desktop\ArchivosC++\Ejercicio6.1.cpp|15|error: no matching function for call to 'std::basic_istream<char>::getline(std::string&, int)'| C:\Users\Edgar\Desktop\ArchivosC++\Ejercicio6.1.cpp|15|note: candidates are:| C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\istream|618|note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::getline(std::basic_istream<_CharT, _Traits>::char_type*, std::streamsize, std::basic_istream<_CharT, _Traits>::char_type) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::char_type = char; std::streamsize = int]| C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\istream|618|note: candidate expects 3 arguments, 2 provided| C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\istream|427|note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::getline(std::basic_istream<_CharT, _Traits>::char_type*, std::streamsize) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::char_type = char; std::streamsize = int]| C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\istream|427|note: no known conversion for argument 1 from 'std::string {aka std::basic_string<char>}' to 'std::basic_istream<char>::char_type* {aka char*}'| C:\Users\Edgar\Desktop\ArchivosC++\Ejercicio6.1.cpp|16|error: expected unqualified-id before '>>' token| ||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
ayuda por favor, ya me duele la cabeza jajajajaaajjaa