versuche hier in diesem Beispiel eine Text-Datei zu lesen.
Code: Alles auswählen
string fim::getContent()
{
string line, content;
ifstream file( fileName );
if(file.good())
{
[b] //Bis hier funktioniert es[/b]
file.seekg(0L, ios::beg);
while(!file.eof())
{
getline( file , line );
content += line;
}
return content;
}
}
Code: Alles auswählen
class fim
{
private:
char fileName[100];
public:
fim(char file[]);
bool fileExists( void );
bool createFile ( void );
bool addInfo( string var, string val );
string getContent( void );
};