Reading in 4 bytes at a time

前端 未结 5 1491
暗喜
暗喜 2021-01-05 01:54

I have a big file full of integers that I\'m loading in. I\'ve just started using C++, and I\'m trying out the filestream stuff. From everything I\'ve read, it appears I c

5条回答
  •  忘掉有多难
    2021-01-05 02:01

    You could try this:

    const int HRSIZE = 129951336/sizeof(int);  //The size of the table
    int bhr[HRSIZE];   //The table
    
    int main(int argc, char *argv[])
    {
        ifstream fstr;
    
        /* load the handranks.dat file */
        std::cout << "Loading table.dat...\n";
        fstr.open("table.dat");
        for (int i=0; i

提交回复
热议问题