Example #1
0
	void	SaveDumpText( LPTSTR lpFilename ){
		CTxtFile	file(lpFilename);
		if( file.IsOpen() )
		{
			TCHAR	buf[256];
			TString	str;
			int	item	= 0;
			int	cnt		= m_wndList.GetItemCount();
			for( ; item<cnt; item++ )
			{
				m_wndList.GetItemText(item, 0, buf, _countof(buf));
				str.assign(buf);
				str.Append(_T("\t"));

				for( int i=0; i<16; i++ ){
					m_wndList.GetItemText(item, i+1, buf, _countof(buf));
					str.AppendFormat(_T("%s "), buf);
				}
				str.Append(_T("\t"));

				m_wndList.GetItemText(item, 17, buf, _countof(buf));
				str.AppendFormat(_T("%s\n\0"), buf);

				file.WriteString(str);
			}

			file.Close();
		}
	}
Example #2
0
	void	DumpFile( LPTSTR lpFilename ){
		BUFFER	buf;
		if( LoadFileData(lpFilename, buf) )
		{
			m_wndList.DeleteAllItems();
			
			TString	str;	

			int	item		= 0;
			unsigned idx	= 0;
			unsigned siz	= buf.size();

			while( idx < siz )
			{
				int	loop	= 16;
				if( int(siz - idx) < 16 ){
					loop	= int(siz - idx);
				}

				str.Format(_T("%08X"), idx);
				m_wndList.InsertItem(item, (LPTSTR)str);

				for( int i=0; i<loop; i++ ){
					str.Format(_T("%02X"), buf.at(idx+i));
					m_wndList.SetItem(item, i+1, (LPTSTR)str);
				}

				str.clear();
				for( int i=0; i<loop; i++ ){
					if( ::isgraph(int(buf.at(idx+i))) )
						str.AppendFormat(_T("%c"), buf.at(idx+i));
					else
						str.AppendFormat(_T(" "));
				}
				m_wndList.SetItem(item, 17, (LPTSTR)str);
			
				idx += 16;
				item += 1;
			}
		}
	}