How to read correctly the CFile buffer from a certain location ?

Here is the code (simplified):
Code:
BOOL CMyDoc::SaveFileModified(CImg<float>& img, const CString sFileName)
{
	CString sDrive, sDir;
	_splitpath(sFileName, sDrive.GetBuffer(), sDir.GetBuffer(), NULL, NULL);

	CString sTemp;
	sTemp.Format(_T("%s%sTemp.tmp"), sDrive, sDir);

	sDrive.ReleaseBuffer();
	sDir.ReleaseBuffer();

	img.get_invert_endianness().save_exr(sTemp);

	CFile fileTemp;
	if (! fileTemp.Open(sTemp, CFile::typeBinary | CFile::modeRead))
		return FALSE;

	char c;
	UINT nRead = 0;
	int nCount = 0;
	ULONGLONG nPosition = 0;
	CByteArray arrHeader, arrData;
	do
	{
		nRead = fileTemp.Read((char*)&c, sizeof(char));
		if (nCount < 20)
		{
			arrHeader.Add(static_cast<BYTE>(c));
		}
		nCount++;
		if (nCount >= 20)    // read the header, so go out
		{
			nPosition = fileTemp.GetPosition();
			break;
		}
	}while (nRead > 0);

	if (nPosition > 1)  // try to read the rest of the file from nPosition to end of the file
	{
		arrData.SetSize(fileTemp.GetLength() - nPosition);
		fileTemp.Read(arrData.GetData(), (UINT)arrData.GetSize());
	}

	fileTemp.Close();

	CFile file;
	if (! file.Open(sFileName, CFile::typeBinary | CFile::modeCreate | CFile::modeReadWrite))
		return FALSE;

	arrHeader.Append(arrData);
	file.Write(arrHeader.GetData(), (UINT)arrHeader.GetSize());
	file.Close();

	return TRUE;
}
the result stored in sFileName is incorrect ... to prove the result I should give more details and the example would be a little complex ... but if is necessary I put the real example here. With this code, I have done something wrong ? Because I am struggle to spot a wrong, but I can't see anything ...