⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 input.cpp

📁 手机选中奖号器
💻 CPP
字号:
// Input.cpp: implementation of the Input class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "RandomPhone.h"
#include "Input.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
void Input::RemoveAll()
{
	POSITION pos = m_input.GetHeadPosition();
	while (pos != NULL)
	{
		delete m_input.GetNext(pos);
	}
	m_input.RemoveAll();
}

Input::Input()
{
	m_fileformat = 2;
}

Input::~Input()
{
    RemoveAll();
}

void Input::LoadFromFile(CString path , int fileformat )
{
#if 0
	for(unsigned int i = 809300000; i <= 809389999; i++)
		m_input.Add(i);
#else
    
	////////////////////////////
    CFile f;
	CString temp;

	if( !f.Open( (LPCSTR)path, CFile::modeRead  ) ) 
	{
        temp.Format("%s文件打开失败!",path);
		AfxMessageBox(temp);
        return;
	}
    CArchive ar( &f, CArchive::load);

	CInputItem *p;
	BOOL  ret;

    while( (ret = ar.ReadString(temp)) == TRUE )
	{
	  temp.TrimLeft();
	  temp.TrimRight();

	  p = new CInputItem;
	  p->city = 0;
	  p->phone = 0;

	  if ( fileformat == 1 )
	  {
	      temp = temp.Right(9);
	      sscanf((LPCSTR)temp,"%d", &(p->phone));
	  }
	  else
	  {
		  //temp = temp.Right(9);
		  char c [100],pp[100];
	      sscanf((LPCSTR)temp,"%s\t%s", c,pp);
		  temp = c;
		  temp.TrimLeft();
		  temp.TrimRight();
		  p->city = atol(temp);

		  temp = pp;
		  temp.TrimLeft();
		  temp.TrimRight();
          temp = temp.Right(9);
		  p->phone = atol(temp);

	  }
	  m_input.AddTail(p);
	}

	m_fileformat = fileformat;
#endif
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -