0
어떻게해야합니까? Visual Studio 2010 C++을 사용하고 있습니다.Ifstream char 배열로
char * Buffer = new char[Filesize];
//Fill it with data here
std::ifstream BinaryParse(Buffer, std::ios::binary);
if(BinaryParse.is_open())
{
BinaryParse.read((char*)&Count, sizeof(unsigned int));
}
그래도 작동하지 않습니다. ifstream을 문자 배열에서 읽는 것을 제외하고 파일을 읽는 것과 같은 방식으로 작동하게하려면 어떻게해야합니까?
하지만 어떻게 std :: strings와 stuff로 읽을 수 있습니까? – Kachinsky
std :: string에는 char * 인수가있는 생성자가 있습니다.이 생성자를 사용하면 버퍼를 std :: string으로 변환 할 수 있습니다. [this] (http://www.cplusplus.com/reference/string/string/string/)을 참조하십시오. – Yang
내가 할 때 의미 >> val (val == std :: string의 경우) – Kachinsky