C/C++生成JSON文件
这里我们就是用一个开源库 cJSON(方法多种多样也可以用其他的库)来生成一个json文件。 如下是… Continue Reading C/C++生成JSON文件
感悟技术人生
这里我们就是用一个开源库 cJSON(方法多种多样也可以用其他的库)来生成一个json文件。 如下是… Continue Reading C/C++生成JSON文件
Tôi muốn mua source code jx2
一些古懂的东西,有些老程序编绎需要用到dshow.h的库,这个在8.0和9.0b的sdk或extra… Continue Reading 一些老版本的DirectX sdk8.0和9.0b含dshow.h
Ihttps://download.csdn.net/download/Augusdi/310387… Continue Reading PLX_9054_9056_8311_WDM PLX系列PCi芯片驱动源码
OLE(对象链接与嵌入)是微软提出的标准,是应用程序间交换数据、相互操作的一种方式,MS OFFIC… Continue Reading RAD Studio10+ 操作office 注意事项
void UTF8toANSI(CString &strUTF8) { //获取转换为多字节… Continue Reading VC++ 下处理 UTF8 编码的字符串
函数原型: BOOL AfxExtractSubString(CString& rStrin… Continue Reading 分割字符串的AfxExtractSubString函数
#include “stdafx.h” #include <iostream> #inc… Continue Reading VC修改文件时间属性(修改/访问时间)
MSDN documentation states that for files larger th… Continue Reading Fixed a BUG of VC++ 6.0
/********** cfile64.h *********/ class CFile64 : public CFile { public: // Attributes ULONGLONG GetPosition(); // Overridables virtual ULONGLONG Seek(LONGLONG lOff, UINT nFrom); virtual void SetLength(ULONGLONG dwNewLen); ULONGLONG GetLength() ; virtual void LockRange(ULONGLONG dwPos, ULONGLONG dwCount); virtual void UnlockRange(ULONGLONG dwPos, ULONGLONG dwCount); }; /*************** cfile64.cpp ***************/ #include "stdafx.h" #include "file64.h" // CFile64 implementation ULONGLONG CFile64::Seek(LONGLONG lOff, UINT nFrom) { ASSERT_VALID(this); ASSERT((HANDLE)m_hFile != INVALID_HANDLE_VALUE); ASSERT(nFrom == begin || nFrom == end || nFrom == current); ASSERT(begin == FILE_BEGIN && end == FILE_END && current == FILE_CURRENT); LARGE_INTEGER liOff; liOff.QuadPart = lOff; liOff.LowPart = ::SetFilePointer((HANDLE)m_hFile, liOff.LowPart, &liOff.HighPart, (DWORD)nFrom); if (liOff.LowPart == (DWORD)-1) if (::GetLastError() != NO_ERROR) CFileException::ThrowOsError((LONG)::GetLastError(), m_strFileName); return liOff.QuadPart; } ULONGLONG CFile64::GetPosition() { ASSERT_VALID(this); ASSERT((HANDLE)m_hFile != INVALID_HANDLE_VALUE); LARGE_INTEGER liPos; liPos.QuadPart = 0; liPos.LowPart = ::SetFilePointer((HANDLE)m_hFile, liPos.LowPart, &liPos.HighPart , FILE_CURRENT); if (liPos.LowPart == (DWORD)-1) if (::GetLastError() != NO_ERROR) CFileException::ThrowOsError((LONG)::GetLastError(), m_strFileName); return liPos.QuadPart; } void CFile64::LockRange(ULONGLONG dwPos, ULONGLONG dwCount) { ASSERT_VALID(this); ASSERT((HANDLE)m_hFile != INVALID_HANDLE_VALUE); ULARGE_INTEGER liPos; ULARGE_INTEGER liCount; liPos.QuadPart = dwPos; liCount.QuadPart = dwCount; if (!::LockFile((HANDLE)m_hFile, liPos.LowPart, liPos.HighPart, liCount.LowPart, liCount.HighPart)) { CFileException::ThrowOsError((LONG)::GetLastError(), m_strFileName); } } void CFile64::UnlockRange(ULONGLONG dwPos, ULONGLONG dwCount) { ASSERT_VALID(this); ASSERT((HANDLE)m_hFile != INVALID_HANDLE_VALUE); ULARGE_INTEGER liPos; ULARGE_INTEGER liCount; liPos.QuadPart = dwPos; liCount.QuadPart = dwCount; if (!::UnlockFile((HANDLE)m_hFile, liPos.LowPart, liPos.HighPart, liCount.LowPart, liCount.HighPart)) { CFileException::ThrowOsError((LONG)::GetLastError(), m_strFileName); } } void CFile64::SetLength(ULONGLONG dwNewLen) { ASSERT_VALID(this); ASSERT((HANDLE)m_hFile != INVALID_HANDLE_VALUE); Seek(dwNewLen, (UINT)begin); if (!::SetEndOfFile((HANDLE)m_hFile)) CFileException::ThrowOsError((LONG)::GetLastError(), m_strFileName); } ULONGLONG CFile64::GetLength() { ASSERT_VALID(this); ULARGE_INTEGER liSize; liSize.LowPart = ::GetFileSize((HANDLE)m_hFile, &liSize.HighPart); if (liSize.LowPart == (DWORD)-1) if (::GetLastError() != NO_ERROR) CFileException::ThrowOsError((LONG)::GetLastError(), m_strFileName); return liSize.QuadPart; } /
LONGLONG是64位整型,这样在理论上可支持的最大文件为18000000000GB,你也可以根据自己的需要重载CFile的其他函数
本文出自:https://blog.csdn.net/jrt88/article/details/4392838/