2014-03-25 4 views
0

fstream 또는 ifstream을 매개 변수로 사용할 수있는 헤더 파일에서 메서드를 정의하는 방법은 무엇입니까?C++ 헤더 파일에 fstream 또는 ifstream 포함

#include <fstream> 
#include <string> 

class hw4 
{ 

     public: 
       // Methods 
       char* cFlagCheck(char* logfile, fstream& f); 
       int sFlagCheck(char* set, fstream& f, ifstream& cpy, int &R, int &X, int &Y); 
       void* runRobot(void* robotCount); 
}; 
+1

ifstream 또는 fstream을 인수 중 하나로 받아들이는 메소드를 어떻게 선언 할 것입니까? 예를 들어, fstream 또는 ifstream을 두 번째 인수로 사용하여 cFlagCheck를 호출 할 수 있기를 원했습니까? – harmic

답변

4

std 네임 스페이스 즉, 앞에 클래스 이름을 추가해야합니다. std::ifstream