亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? stdiofileex.cpp

?? 管理項目進度工具的原代碼
?? CPP
// StdioFileEx.cpp: implementation of the CStdioFileEx class.
//
// Version 1.1 23 August 2003. Incorporated fixes from Dennis Jeryd.
// Version 1.3 19 February 2005. Incorporated fixes Howard J Oh and some of my own.
//
// Copyright David Pritchard 2003-2005. davidpritchard@ctv.es
//
// You can use this class freely, but please keep my ego happy 
// by leaving this comment in place.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "StdioFileEx.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

/*static*/ const UINT CStdioFileEx::modeWriteUnicode = 0x20000; // Add this flag to write in Unicode

CStdioFileEx::CStdioFileEx(): CStdioFile()
{
	m_bIsUnicodeText = false;
}

CStdioFileEx::CStdioFileEx(LPCTSTR lpszFileName,UINT nOpenFlags)
	:CStdioFile(lpszFileName, ProcessFlags(lpszFileName, nOpenFlags))
{
}

BOOL CStdioFileEx::Open(LPCTSTR lpszFileName,UINT nOpenFlags,CFileException* pError /*=NULL*/)
{
	// Process any Unicode stuff
	ProcessFlags(lpszFileName, nOpenFlags);

	return CStdioFile::Open(lpszFileName, nOpenFlags, pError);
}

BOOL CStdioFileEx::ReadString(CString& rString)
{
	BOOL			bReadData;
	LPTSTR		lpsz;
	int			nLen = 0; //, nMultiByteBufferLength = 0, nChars = 0;
	CString		sTemp;

	// If at position 0, discard byte-order mark before reading
	if (!m_pStream || (GetPosition() == 0 && m_bIsUnicodeText))
	{
		wchar_t	cDummy;
		Read(&cDummy, sizeof(wchar_t));
	}

// If compiled for Unicode
#ifdef _UNICODE
	// Do standard stuff -- both ANSI and Unicode cases seem to work OK
	bReadData = CStdioFile::ReadString(rString);
#else

	if (!m_bIsUnicodeText)
	{
		// Do standard stuff -- read ANSI in ANSI
		bReadData = CStdioFile::ReadString(rString);
	}
	else
	{
		const int nMAX_LINE_CHARS = 4096;
		wchar_t* pszUnicodeString = new wchar_t[nMAX_LINE_CHARS]; 
		char* pszMultiByteString= new char[nMAX_LINE_CHARS];  

		// Read as Unicode, convert to ANSI; fixed by Dennis Jeryd 6/8/03
		bReadData = (NULL != fgetws(pszUnicodeString, nMAX_LINE_CHARS, m_pStream));
		if (GetMultiByteStringFromUnicodeString(pszUnicodeString, pszMultiByteString, nMAX_LINE_CHARS))
		{
			rString = (CString)pszMultiByteString;
		}

		if (pszUnicodeString)
		{
			delete pszUnicodeString;
		}

		if (pszMultiByteString)
		{
			delete pszMultiByteString;
		}
	}
#endif

	// Then remove end-of-line character if in Unicode text mode
	if (bReadData)
	{
		// Copied from FileTxt.cpp but adapted to Unicode and then adapted for end-of-line being just '\r'. 
		nLen = rString.GetLength();
		if (nLen > 1 && rString.Mid(nLen-2) == sNEWLINE)
		{
			rString.GetBufferSetLength(nLen-2);
		}
		else
		{
			lpsz = rString.GetBuffer(0);
			if (nLen != 0 && (lpsz[nLen-1] == _T('\r') || lpsz[nLen-1] == _T('\n')))
			{
				rString.GetBufferSetLength(nLen-1);
			}
		}
	}

	return bReadData;
}

// --------------------------------------------------------------------------------------------
//
//	CStdioFileEx::WriteString()
//
// --------------------------------------------------------------------------------------------
// Returns:    void
// Parameters: LPCTSTR lpsz
//
// Purpose:		Writes string to file either in Unicode or multibyte, depending on whether the caller specified the
//					CStdioFileEx::modeWriteUnicode flag. Override of base class function.
// Notes:		If writing in Unicode we need to:
//						a) Write the Byte-order-mark at the beginning of the file
//						b) Write all strings in byte-mode
//					-	If we were compiled in Unicode, we need to convert Unicode to multibyte if 
//						we want to write in multibyte
//					-	If we were compiled in multi-byte, we need to convert multibyte to Unicode if 
//						we want to write in Unicode.
// Exceptions:	None.
//
void CStdioFileEx::WriteString(LPCTSTR lpsz)
{
	// If writing Unicode and at the start of the file, need to write byte mark
	if (m_nFlags & CStdioFileEx::modeWriteUnicode)
	{
		// If at position 0, write byte-order mark before writing anything else
		if (!m_pStream || GetPosition() == 0)
		{
			wchar_t cBOM = (wchar_t)nUNICODE_BOM;
			CFile::Write(&cBOM, sizeof(wchar_t));
		}
	}

// If compiled in Unicode...
#ifdef _UNICODE

	// If writing Unicode, no conversion needed
	if (m_nFlags & CStdioFileEx::modeWriteUnicode)
	{
		// Write in byte mode
		CFile::Write(lpsz, lstrlen(lpsz) * sizeof(wchar_t));
	}
	// Else if we don't want to write Unicode, need to convert
	else
	{
		int		nChars = lstrlen(lpsz) + 1;				// Why plus 1? Because yes
		int		nBufferSize = nChars * sizeof(char);
		wchar_t*	pszUnicodeString	= new wchar_t[nChars]; 
		char	*	pszMultiByteString= new char[nChars];  
		int		nCharsWritten = 0;

		// Copy string to Unicode buffer
		lstrcpy(pszUnicodeString, lpsz);

		// Get multibyte string
		nCharsWritten = 
			GetMultiByteStringFromUnicodeString(pszUnicodeString, pszMultiByteString, ( short ) nBufferSize, GetACP());
		
		if (nCharsWritten > 0)
		{
			//   CFile::Write((const void*)pszMultiByteString, lstrlen(lpsz));

			// Do byte-mode write using actual chars written (fix by Howard J Oh)
			CFile::Write((const void*)pszMultiByteString,
				nCharsWritten*sizeof(char));
		}

		if (pszUnicodeString && pszMultiByteString)
		{
			delete [] pszUnicodeString;
			delete [] pszMultiByteString;
		}
	}
// Else if *not* compiled in Unicode
#else
	// If writing Unicode, need to convert
	if (m_nFlags & CStdioFileEx::modeWriteUnicode)
	{
		int		nChars = lstrlen(lpsz) + 1;	 // Why plus 1? Because yes
		wchar_t*	pszUnicodeString	= new wchar_t[nChars];
		char	*	pszMultiByteString= new char[nChars]; 
		int		nCharsWritten = 0;
		
		// Copy string to multibyte buffer
		lstrcpy(pszMultiByteString, lpsz);

		nCharsWritten =
			GetUnicodeStringFromMultiByteString(pszMultiByteString,
			pszUnicodeString, nChars, GetACP());
		
		if (nCharsWritten > 0)
		{
			//   CFile::Write(pszUnicodeString, lstrlen(lpsz) * sizeof(wchar_t));

			// Write in byte mode. Write actual number of chars written * bytes (fix by Howard J Oh)
			CFile::Write(pszUnicodeString, nCharsWritten*sizeof(wchar_t));
		}
		else
		{
			ASSERT(false);
		}

		if (pszUnicodeString && pszMultiByteString)
		{
			delete [] pszUnicodeString;
			delete [] pszMultiByteString;
		}
	}
	// Else if we don't want to write Unicode, no conversion needed
	else
	{
		// Do standard stuff
		//CStdioFile::WriteString(lpsz);
		
		// Do byte-mode write. This avoids annoying "interpretation" of \n's as	\r\n
		CFile::Write((const void*)lpsz, lstrlen(lpsz)*sizeof(char));
	}

#endif
}

UINT CStdioFileEx::ProcessFlags(const CString& sFilePath, UINT& nOpenFlags)
{
	m_bIsUnicodeText = false;

	// If we have writeUnicode we must have write or writeRead as well
#ifdef _DEBUG
	if (nOpenFlags & CStdioFileEx::modeWriteUnicode)
	{
		ASSERT(nOpenFlags & CFile::modeWrite || nOpenFlags & CFile::modeReadWrite);
	}
#endif

	// If reading in text mode and not creating... ; fixed by Dennis Jeryd 6/8/03
	if (nOpenFlags & CFile::typeText && !(nOpenFlags & CFile::modeCreate) && !(nOpenFlags & CFile::modeWrite ))
	{
		m_bIsUnicodeText = IsFileUnicode(sFilePath);

		// If it's Unicode, switch to binary mode
		if (m_bIsUnicodeText)
		{
			nOpenFlags ^= CFile::typeText;
			nOpenFlags |= CFile::typeBinary;
		}
	}

	m_nFlags = nOpenFlags;

	return nOpenFlags;
}

// --------------------------------------------------------------------------------------------
//
//	CStdioFileEx::IsFileUnicode()
//
// --------------------------------------------------------------------------------------------
// Returns:    bool
// Parameters: const CString& sFilePath
//
// Purpose:		Determines whether a file is Unicode by reading the first character and detecting
//					whether it's the Unicode byte marker.
// Notes:		None.
// Exceptions:	None.
//
/*static*/ bool CStdioFileEx::IsFileUnicode(const CString& sFilePath)
{
	CFile				file;
	bool				bIsUnicode = false;
	wchar_t			cFirstChar;
	CFileException	exFile;

	// Open file in binary mode and read first character
	if (file.Open(sFilePath, CFile::typeBinary | CFile::modeRead, &exFile))
	{
		// If byte is Unicode byte-order marker, let's say it's Unicode
		if (file.Read(&cFirstChar, sizeof(wchar_t)) > 0 && cFirstChar == (wchar_t)nUNICODE_BOM)
		{
			bIsUnicode = true;
		}

		file.Close();
	}
	else
	{
		// Handle error here if you like
	}

	return bIsUnicode;
}

unsigned long CStdioFileEx::GetCharCount()
{
	int				nCharSize;
	unsigned long	nByteCount, nCharCount = 0;

	if (m_pStream)
	{
		// Get size of chars in file
		nCharSize = m_bIsUnicodeText ? sizeof(wchar_t): sizeof(char);

		// If Unicode, remove byte order mark from count
		nByteCount = GetLength();
		
		if (m_bIsUnicodeText)
		{
			nByteCount = nByteCount - sizeof(wchar_t);
		}

		// Calc chars
		nCharCount = (nByteCount / nCharSize);
	}

	return nCharCount;
}

// --------------------------------------------------------------------------------------------
//
//	CStdioFileEx::GetUnicodeStringFromMultiByteString()
//
// --------------------------------------------------------------------------------------------
// Returns:    int - num. of chars written (0 means error)
// Parameters: char *		szMultiByteString		(IN)		Multi-byte input string
//					wchar_t*		szUnicodeString		(OUT)		Unicode outputstring
//					int&			nUnicodeBufferSize	(IN/OUT)	Size of Unicode output buffer(IN)
//																			Actual bytes written to buffer (OUT)
//					UINT			nCodePage				(IN)		Code page used to perform conversion
//																			Default = -1 (Get local code page).
//
// Purpose:		Gets a Unicode string from a MultiByte string.
// Notes:		None.
// Exceptions:	None.
//
int CStdioFileEx::GetUnicodeStringFromMultiByteString(IN char * szMultiByteString, OUT wchar_t* szUnicodeString, IN OUT int& nUnicodeBufferSize, IN UINT nCodePage)
{
	int		nCharsWritten = 0;
		
	if (szUnicodeString && szMultiByteString)
	{
		// If no code page specified, take default for system
		if (nCodePage == -1)
		{
			nCodePage = GetACP();
		}

		try 
		{
			// Zero out buffer first. NB: nUnicodeBufferSize is NUMBER OF CHARS, NOT BYTES!
			memset((void*)szUnicodeString, '\0', sizeof(wchar_t) *
				nUnicodeBufferSize);

			nCharsWritten = MultiByteToWideChar(nCodePage,MB_PRECOMPOSED,szMultiByteString,-1,szUnicodeString,nUnicodeBufferSize);
		}
		catch(...)
		{
			TRACE(_T("Controlled exception in MultiByteToWideChar!\n"));
		}
	}

	// Now fix nCharsWritten
	if (nCharsWritten > 0)
	{
		nCharsWritten--;
	}
	
	ASSERT(nCharsWritten > 0);
	return nCharsWritten;
}

// --------------------------------------------------------------------------------------------
//
//	CStdioFileEx::GetMultiByteStringFromUnicodeString()
//
// --------------------------------------------------------------------------------------------
// Returns:    int - number of characters written. 0 means error
// Parameters: wchar_t *	szUnicodeString			(IN)	Unicode input string
//					char*			szMultiByteString			(OUT)	Multibyte output string
//					short			nMultiByteBufferSize		(IN)	Multibyte buffer size
//					UINT			nCodePage					(IN)	Code page used to perform conversion
//																			Default = -1 (Get local code page).
//
// Purpose:		Gets a MultiByte string from a Unicode string
// Notes:		None.
// Exceptions:	None.
//
int CStdioFileEx::GetMultiByteStringFromUnicodeString(wchar_t * szUnicodeString, char* szMultiByteString, 
																			short nMultiByteBufferSize, UINT nCodePage)
{
	BOOL		bUsedDefChar	= FALSE;
	int		nCharsWritten = 0;

	if (szUnicodeString && szMultiByteString) 
	{
		// Zero out buffer first
		memset((void*)szMultiByteString, '\0', nMultiByteBufferSize);
		
		// If no code page specified, take default for system
		if (nCodePage == -1)
		{
			nCodePage = GetACP();
		}

		try 
		{
			nCharsWritten = WideCharToMultiByte(nCodePage, WC_COMPOSITECHECK | WC_SEPCHARS,
							szUnicodeString,-1, szMultiByteString, nMultiByteBufferSize, sDEFAULT_UNICODE_FILLER_CHAR, &bUsedDefChar);
		}
		catch(...) 
		{
			TRACE(_T("Controlled exception in WideCharToMultiByte!\n"));
		}
	} 

	// Now fix nCharsWritten 
	if (nCharsWritten > 0)
	{
		nCharsWritten--;
	}
	
	return nCharsWritten;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本在线播放一区二区三区| 免费三级欧美电影| 国产一区二区三区四| 精品国产污污免费网站入口 | 亚洲第一在线综合网站| 777xxx欧美| 久久99精品一区二区三区| 亚洲一级二级三级在线免费观看| 在线精品视频一区二区三四 | 国产精品久久久久久久久久免费看| 国产激情视频一区二区在线观看| 亚洲欧美在线观看| 欧美性受xxxx黑人xyx性爽| 日韩国产欧美在线观看| 久久久三级国产网站| 99久久er热在这里只有精品66| 一区二区三区在线观看网站| 日韩一区二区在线观看视频播放| 国产精品77777| 亚洲综合色成人| 日韩视频一区二区在线观看| 成人国产亚洲欧美成人综合网| 亚洲欧美日韩一区| 日韩欧美国产一区二区三区| 成人污污视频在线观看| 亚洲第一福利视频在线| 国产日韩精品一区二区三区在线| 欧洲一区在线电影| 国产激情91久久精品导航| 一片黄亚洲嫩模| 久久综合久久99| 欧美日韩中文国产| 粗大黑人巨茎大战欧美成人| 日韩精品福利网| 日韩理论片一区二区| 日韩欧美国产一区二区三区 | 伦理电影国产精品| 日韩毛片一二三区| 久久久久久一级片| 欧美日韩精品一区视频| www.欧美日韩| 紧缚奴在线一区二区三区| 一区二区三区电影在线播| 久久奇米777| 欧美一级高清片| 欧美中文字幕一区| 国产成人免费高清| 另类人妖一区二区av| 亚洲成人激情av| 亚洲欧洲日本在线| 久久久99精品久久| 日韩亚洲欧美高清| 日本道色综合久久| 波多野结衣精品在线| 蜜桃久久av一区| 午夜精品免费在线观看| 亚洲免费在线视频| 最新不卡av在线| 国产精品欧美经典| 国产人成亚洲第一网站在线播放 | 日韩一区二区三区四区五区六区| 91麻豆免费观看| www.视频一区| voyeur盗摄精品| 成人听书哪个软件好| 激情六月婷婷综合| 国内久久婷婷综合| 美腿丝袜亚洲三区| 蜜桃视频免费观看一区| 偷拍自拍另类欧美| 一区二区三区在线免费观看| 日韩理论电影院| 亚洲美女精品一区| 亚洲欧美日韩国产手机在线| 成人欧美一区二区三区1314| 国产精品久久看| 精品亚洲成a人| 麻豆国产欧美一区二区三区| 捆绑调教一区二区三区| 蜜臀a∨国产成人精品| 久99久精品视频免费观看| 精品一区二区三区久久| 国产最新精品免费| 国产成人aaa| 粉嫩蜜臀av国产精品网站| 成人毛片老司机大片| 成人18精品视频| 99精品国产热久久91蜜凸| 在线视频亚洲一区| 欧美精品一二三区| wwwwxxxxx欧美| 国产欧美日韩中文久久| 一区在线中文字幕| 一区二区三区免费在线观看| 午夜精品一区在线观看| 激情都市一区二区| 99在线精品观看| 欧美性受xxxx| 日韩欧美高清dvd碟片| 精品少妇一区二区三区在线播放| 国产日韩高清在线| 亚洲色图制服诱惑| 日韩福利电影在线观看| 国产乱码字幕精品高清av| 国产91丝袜在线18| 在线观看成人小视频| 日韩一区二区精品在线观看| 国产欧美一区二区三区在线老狼| 一区二区不卡在线播放| 精品一区二区在线视频| 色综合久久久久久久久| 日韩女优电影在线观看| 自拍偷拍亚洲激情| 美女诱惑一区二区| 91在线国产观看| 日韩欧美二区三区| 一区二区三区免费网站| 国产一区二区不卡在线| 欧美日韩成人综合| 国产精品色呦呦| 日本aⅴ免费视频一区二区三区| 丁香婷婷深情五月亚洲| 在线91免费看| 亚洲人被黑人高潮完整版| 久久精品99国产精品日本| 91一区一区三区| 久久这里只精品最新地址| 亚洲一二三四区不卡| 国产成人自拍高清视频在线免费播放| 欧美亚洲日本一区| 国产香蕉久久精品综合网| 日本怡春院一区二区| 色综合天天综合色综合av | 最新不卡av在线| 韩国视频一区二区| 欧美日韩一级片在线观看| 国产精品每日更新| 精品亚洲免费视频| 7777精品久久久大香线蕉| 亚洲欧美在线视频| 国产精品影视在线观看| 91精品国产综合久久久久久| 亚洲欧美日韩成人高清在线一区| 国内欧美视频一区二区| 69久久99精品久久久久婷婷| 夜夜爽夜夜爽精品视频| 99久久er热在这里只有精品15| 国产人成亚洲第一网站在线播放| 免费成人深夜小野草| 欧美日韩午夜影院| 亚洲综合成人在线视频| 99精品视频一区| 国产精品婷婷午夜在线观看| 国产电影一区二区三区| 亚洲精品一区二区精华| 奇米影视在线99精品| 欧美一区二区视频在线观看| 亚洲国产视频网站| 欧美亚洲动漫另类| 亚洲电影在线免费观看| 色婷婷综合久久| 一区二区三区欧美视频| 色系网站成人免费| 依依成人精品视频| 欧洲亚洲精品在线| 亚洲国产精品天堂| 欧美男人的天堂一二区| 视频一区二区三区入口| 欧美一区二区视频网站| 男男视频亚洲欧美| 欧美第一区第二区| 韩国欧美一区二区| 国产亚洲污的网站| 成人激情小说网站| 亚洲视频一区二区在线观看| 成人aaaa免费全部观看| 亚洲免费观看视频| 欧美老肥妇做.爰bbww| 日本午夜精品视频在线观看 | 色综合久久88色综合天天6| 亚洲精品成人悠悠色影视| 欧美色网一区二区| 日韩av电影一区| 欧美精品一区二区三区蜜臀| 福利一区福利二区| 亚洲视频网在线直播| 欧美日韩中文国产| 麻豆成人免费电影| 亚洲国产精品成人综合色在线婷婷 | 欧美一区二区免费| 国产乱人伦精品一区二区在线观看| 欧美激情资源网| 色女孩综合影院| 日韩vs国产vs欧美| 国产欧美日产一区| 欧美日韩免费一区二区三区| 黄网站免费久久| 一区二区三区在线观看视频| 日韩三级视频在线看| 成人av网站在线观看免费|