Case1: using ReadFile()Show your complete code for both case: when using ifstream and when using ReadFile
Case2: using fopen_sCode:#define BUF_SIZE 5000 BOOL bSuccess = FALSE; char Buf[BUF_SIZE]; DWORD dwRead; for (;;) { bSuccess = ReadFile( V_hChildStd_OUT_Rd, Buf, BUF_SIZE, &dwRead, NULL); if( ! bSuccess || dwRead == 0 ) break; } const int nDoubles = dwRead / sizeof(double); for (int i=0; i<nDoubles ; ++i) { double x = *reinterpret_cast<double*>(&chBuf[i*sizeof(double)]); }
Code:double x; FILE* pFile; fopen_s(&pFile, PathName.Left(PathName.ReverseFind('\\')) + "\\Fortran.bin", "rb"); fread((char*)&x,1,sizeof(double),pFile); fclose(pFile);




Reply With Quote
