ifstream

    3

    2답변

    같이, 나는 C를 배우고 ++와 나는이 ifstream 방법에 문자열를 사용하기 위해 노력하고있어 몇 가지 문제를 얻고 문자열을 넣어 여기에 전체 코드입니다 : // obtaining file size #include <iostream> #include <fstream> using namespace std; int main (int argc, ch

    138

    4답변

    std::ifstream을 사용할 때 수동으로 close()으로 전화해야합니까? 코드의 예를 들어 : std::string readContentsOfFile(std::string fileName) { std::ifstream file(fileName.c_str()); if (file.good()) { std::stringst

    8

    3답변

    2 진 파일에서 부호없는 바이트를 읽으려고합니다. 그래서 다음 코드를 작성했습니다. #include <iostream> #include <fstream> #include <vector> #include <istream> std::string filename("file"); size_t bytesAvailable = 128; size_t toRe

    2

    2답변

    // stream from file. ifstream file; int main (int argc, char * argv[]) { // get argument passed from command line // This is file name if (argc != 2) { cout << "use: ./executable <filename

    -2

    1답변

    아래 vector<int> synsAux에있는 정크를 제거하고 싶습니다. 인쇄 할 내용 : 1 7 7 1 첫 번째 및 세 번째 숫자 앞에 추가 2자를 가져 오는 이유는 무엇입니까? 이 2 빈 공간이나 뭔가 ascii 값이 있습니까? 그 독서를 피하려면 어떻게해야합니까? dictionary.txt 1 cute 2 hello 3 ugly 4 e

    1

    2답변

    ifstreams의 벡터를 만들고 조작하려면 어떻게해야합니까? 이 제외하고이 같은 뭔가가 작동하지 않습니다 당신은 std::vector에 ifstream의를 저장할 수 없습니다 vector<ifstream> Files(10, ifstream()); Files[0].open("File");

    4

    3답변

    이제 많은 데이터가 들어있는 파일이 있습니다. 그리고 필요한 데이터가 위치 (long) x에서 시작하고 주어진 크기 (sizeof (y))를가집니다. 이 데이터를 얻으려면 어떻게해야합니까?

    11

    4답변

    사용자가 파일 이름뿐 아니라 파일이있는 전체 경로를 사용자에게 제공하기를 원합니다. 이 방법으로 파일을 열려면 어떻게해야합니까? ifstream file; file.open("C:/Demo.txt", ios::in); 이 작동하지 않습니다 는 다음과 같이 그것입니다.

    1

    1답변

    , 나는 다음과 같다 몇 가지 코드가 있습니다 ifs.open("foo"); while (!ifs.eof()) { ifs.read(&bar,sizeof(bar)); loc = ifs.tellg(); loc += bar.dwHeaderSize; // four byte boundary padding if ((lo