I want to pass the variable tabe
(which is of type ifstream
) by reference to a function (I do not want a copy of it, just that the function to change it), well, I do not quite understand how it is done that.
Code:
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
using namespace std;
string apaga_espaco(ifstream* tabe)
{
string s;
char N;
while ((tabe*).good())
{
getline((tabe*), s);
s.erase(0,29);
N=s.find(':');
s.erase(0,N+6);
return 0;
}
}
int main()
{
ifstream tabe;
char N;
tabe.open("Tabela.txt", ios::in);
if (!tabe.is_open())
{
cout << "Arquivo nao encontrado, erro fatal!";
exit(1);
}
apaga_espaco(*tabe);
}