처음에는 응용 프로그램 시작시 모든 변수를 메모리에로드했습니다. 시간이 지남에 따라 변수의 수가 너무 많아서 더 이상 필요하지 않게되었습니다. 대신 매핑 된 파일을 사용해야하는 경우에만 가져 오는 것이지만 다른 이야기입니다.파일의 데이터 위치
먼저 변수를 파일에 씁니다. (이 ... 여러 번 반복)
vector<udtAudioInfo>::iterator it = nAudioInfos.Content().begin();
for (;it != nAudioInfos.Content().end(); ++it)
//I think here I should store the position where the data will begin in the file
//I still need to add code for that...
//now write the variables
fwrite(&it->UnitID,sizeof(int),1,outfile);
fwrite(&it->FloatVal,sizeof(double),1,outfile);
//I think here I should store the length of the data written
//I still need to add code for that...
}
하지만 지금은 동적으로 변수를로드하는 데 필요한, 나는 그들이 실제로 저장되는 위치를 추적 할 필요가있다.
내 질문은 : 현재 쓰기 위치를 어떻게 알 수 있습니까? 데이터를 실제로 파일에 저장하는 위치를 추적하기 위해이 방법을 사용할 수 있기를 바랍니다.
'ftell'을 들여다 보았습니까? – GWW