CPmap.h
#pragma warning(disable: 4786) // vc中去除STL使用带来的警告
#ifndef __CFGWRITER_H__ //防止重复调用头文件
#define __CFGWRITER_H__
#include "StdAfx.h"
#include <string>
#include <map>
#include <iterator>
#include <iostream>
using namespace std;
typedef map<string,string,less<string> > Mmap;//
typedef Mmap::iterator MIt; //
class CPmap
{
public:
CPmap();
CPmap(string mpath);
Mmap public_map;
//MIt It;
virtual ~CPmap();
void show();
private:
string path;
bool do_open(const char* mpath);
};
#endif // !defined(AFX_PMAP_H__1A8D3C1B_6420_4A67_A5EB_C4CE390B2925__INCLUDED_)
CPmap.cpp
// Pmap.cpp: implementation of the CPmap class.
//
//
#include "stdafx.h"
#include "Pmap.h"
#include "Write.h"
#include <fstream>
#include <vector>
#include <algorithm> //use zhe for_each()
#define LEFT [
#define RIGHT ]
#define NOTES #
#define EQUAL =
#include <iostream>
using namespace std;
//
// Construction/Destruction
//
const char* const MIDDLE = "***";
CPmap::CPmap()
{
cout<<"don't find File"<<endl;
}
CPmap::CPmap(string mpath)
{
this->path=mpath;
if(do_open(mpath.c_str()))
cout<<"open the File: ok"<<endl;
else
cout<<"open the File:Error"<<endl;
}
CPmap::~CPmap()
{
}
bool CPmap::do_open(const char* mpath)
{
ifstream fin(mpath);
if (!fin.is_open())
return false;
vector<string> strvect;
vector<string>::iterator it;
string buffe
c++ 实现对文件的读取和查找(写暂时没写)
最新推荐文章于 2022-05-06 14:33:32 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)