Hallo Leute,
ich häng grad an nem Problem und komm nicht weiter. Wäre nett wenn mir sagen würde was hier falsch läuft. Ich möchte direkt im Konstruktor eine Datei öffnen. Wie macht ihr das?
Grüsse
parser.h:
parser.cpp
ich häng grad an nem Problem und komm nicht weiter. Wäre nett wenn mir sagen würde was hier falsch läuft. Ich möchte direkt im Konstruktor eine Datei öffnen. Wie macht ihr das?
Grüsse
parser.h:
Code:
#ifndef PARSER_H_
#define PARSER_H_
#include <fstream>
class Parser
{
private:
std::ifstream fd;
char* dirs;
char* compress;
public:
Parser(char*);
~Parser();
char* getValue(char*);
};
#endif /*PARSER_H_*/
parser.cpp
Code:
#include <iostream>
#include <fstream>
#include "parser.h"
Parser::Parser(char* p_file)
{
fd(p_file);
}
Parser::~Parser()
{
//fd.close();
}
char* Parser::getValue(char* var)
{
return var;
}
Code:
**** Build of configuration Release for project cpp ****
make -k all
Building file: ../parser.cpp
Invoking: GCC C++ Compiler
g++ -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"parser.d" -MT"parser.d" -o"parser.o" "../parser.cpp"
../parser.cpp: In constructor 'Parser::Parser(char*)':
../parser.cpp:7: error: no match for call to '(std::ifstream) (char*&)'
make: *** [parser.o] Error 1
make: Target `all' not remade because of errors.
Build complete for project cpp