WPS使Office变慢的处理
WPS使Office变慢的处理 在单位一直使用Office2016,运行很流畅。而WPS主要是家里的… Continue Reading WPS使Office变慢的处理
感悟技术人生
WPS使Office变慢的处理 在单位一直使用Office2016,运行很流畅。而WPS主要是家里的… Continue Reading WPS使Office变慢的处理
CLogFile::CLogFile() { } CLogFile::~CLogFile() { }… Continue Reading CLogFile写日志
这部分实现的源码完全参考官方文档的算法描述,连变量名也尽可能和官方文档中的变量保持一致,方便学习。 … Continue Reading 国密SM3密码杂凑算法原理及实现(附源码)
#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/
对 C 语言的综合运用,在 Linux 下实现音乐播放器的第一步。
lrc 是歌词文件的常用扩展名,它将歌曲信息、歌词、歌词时间以某种特定的格式保存在文件中。
对于刚学习了 C 语言链表和文件操作,想要练习和巩固的人来说,将 lrc 文件中包含的歌曲信息、歌词、歌词时间解析出来是个不错的选择