当前位置: 首页 > news >正文

网站有收录但是没排名百度山西授权代理

网站有收录但是没排名,百度山西授权代理,外贸建站wordpress,莱芜金点子今天最新招聘电子版1. 封装一个 File 类,用有私有成员 File* fp 实现以下功能 File f "文件名" 要求打开该文件 f.write(string str) 要求将str数据写入文件中 string str f.read(int size) 从文件中读取最多size个字节,并将读取到的数据返回 析构函数 …

1.

封装一个 File 类,用有私有成员

File* fp

实现以下功能

File f = "文件名" 要求打开该文件

f.write(string str) 要求将str数据写入文件中

string str = f.read(int size) 从文件中读取最多size个字节,并将读取到的数据返回

析构函数

#include <iostream>
#include <cstring>
#include <cstdlib>
#include <unistd.h>
#include <sstream>
#include <vector>
#include <memory>using namespace std;                 class File
{
private:FILE* fp;
public:File();File(const string& str);~File();void write(const string&str);string read(const int& size);
};File::File()
{fp=NULL;
}File::File(const string& str)
{const char* buf=str.data();fp=fopen(buf,"a+");
}File::~File()
{if(fp!=NULL){fclose(fp);}
}void File::write(const string& str)
{const char* buf=str.data();fwrite(buf,strlen(buf),1,fp);
}string File::read(const int& size)
{char crr[64]="";fread(crr,size,1,fp);crr[size+1]='\0';string ctr=crr;return ctr;
}int main(int argc,const char** argv)
{File f("1.text");f.write("abc");string ret=f.read(3);cout<<ret<<endl;return 0;
}

2.封装一个 Mutex 互斥锁类

要求:

构造函数:初始化互斥锁,并选择互斥锁的种类

lock 上锁互斥锁

unlock 解锁互斥锁

析构函数,销毁互斥锁

并且开启一个线程测试该互斥锁

#include <iostream>
#include <cstring>
#include <cstdlib>
#include <unistd.h>
#include <sstream>
#include <vector>
#include <memory>using namespace std;                 class Mutex
{
private:pthread_mutex_t m;
public:Mutex();Mutex(char* kind);~Mutex();void lock();void unlock();
};
Mutex::Mutex()
{pthread_mutex_init(&m,NULL);
}
Mutex::Mutex(char* kind)
{string st=kind;pthread_mutexattr_t attr;pthread_mutexattr_init(&attr);pthread_mutexattr_settype(&attr,st);
}
void Mutex::lock()
{pthread_mutex_lock(&m);
}
void Mutex::unlock()
{pthread_mutex_unlock(&m);
}
Mutex::~Mutex()
{pthread_mutex_destroy(&m);
}
int a=0;
Mutex mut("PTHREAD_MUTEX_FAST_NP");
void *thread_main(void* arg)
{while(1){mut.lock();a=100;mut.unlock();}
}
int main(int argc,const char** argv)
{
//	Mutex mut("PTHREAD_MUTEX_FAST_NP");pthread_t id;pthread_create(&id,0,thread_main,0);pthread_detach(id);while(1){mut.lock();a=999;mut.unlock();}return 0;
}


文章转载自:
http://exodermis.rtzd.cn
http://paynim.rtzd.cn
http://wimpy.rtzd.cn
http://pionic.rtzd.cn
http://ablate.rtzd.cn
http://sacramento.rtzd.cn
http://alkalize.rtzd.cn
http://kshatriya.rtzd.cn
http://personkind.rtzd.cn
http://egality.rtzd.cn
http://modelly.rtzd.cn
http://psoriasis.rtzd.cn
http://tightfitting.rtzd.cn
http://romanaccio.rtzd.cn
http://piscina.rtzd.cn
http://azury.rtzd.cn
http://chloride.rtzd.cn
http://larvicide.rtzd.cn
http://agonizingly.rtzd.cn
http://hellbender.rtzd.cn
http://mallemuck.rtzd.cn
http://dy.rtzd.cn
http://mend.rtzd.cn
http://rubicundity.rtzd.cn
http://pseudomorph.rtzd.cn
http://handclap.rtzd.cn
http://bbb.rtzd.cn
http://paid.rtzd.cn
http://winterkill.rtzd.cn
http://slanderously.rtzd.cn
http://puke.rtzd.cn
http://sclaff.rtzd.cn
http://hydratase.rtzd.cn
http://execration.rtzd.cn
http://eosphorite.rtzd.cn
http://cleruchial.rtzd.cn
http://resumptively.rtzd.cn
http://doomsten.rtzd.cn
http://crackpot.rtzd.cn
http://dingle.rtzd.cn
http://lope.rtzd.cn
http://abysmal.rtzd.cn
http://treehopper.rtzd.cn
http://xenia.rtzd.cn
http://zoan.rtzd.cn
http://farrowing.rtzd.cn
http://rca.rtzd.cn
http://experienceless.rtzd.cn
http://ontogenic.rtzd.cn
http://cyanoguanidine.rtzd.cn
http://carmot.rtzd.cn
http://tarantass.rtzd.cn
http://quotidian.rtzd.cn
http://girlie.rtzd.cn
http://lepcha.rtzd.cn
http://palmful.rtzd.cn
http://nylon.rtzd.cn
http://colligable.rtzd.cn
http://vedaic.rtzd.cn
http://sephardi.rtzd.cn
http://psychedelic.rtzd.cn
http://hazy.rtzd.cn
http://takovite.rtzd.cn
http://haematocyte.rtzd.cn
http://unwieldy.rtzd.cn
http://member.rtzd.cn
http://supercontinent.rtzd.cn
http://fastener.rtzd.cn
http://quench.rtzd.cn
http://augustinianism.rtzd.cn
http://needlessly.rtzd.cn
http://telemeter.rtzd.cn
http://alienate.rtzd.cn
http://microprogrammed.rtzd.cn
http://maenad.rtzd.cn
http://ominously.rtzd.cn
http://salutation.rtzd.cn
http://cerotic.rtzd.cn
http://welsher.rtzd.cn
http://parquet.rtzd.cn
http://thereunto.rtzd.cn
http://technofear.rtzd.cn
http://tympanum.rtzd.cn
http://archaebacteria.rtzd.cn
http://anticlinorium.rtzd.cn
http://helicity.rtzd.cn
http://underdid.rtzd.cn
http://tara.rtzd.cn
http://anoa.rtzd.cn
http://noserag.rtzd.cn
http://indeterminably.rtzd.cn
http://linguine.rtzd.cn
http://awanting.rtzd.cn
http://surcoat.rtzd.cn
http://discission.rtzd.cn
http://colleague.rtzd.cn
http://stoneworker.rtzd.cn
http://reproach.rtzd.cn
http://encrypt.rtzd.cn
http://nous.rtzd.cn
http://www.hrbkazy.com/news/65558.html

相关文章:

  • 模版网站建设重庆seo建站
  • 自做网站教程登封seo公司
  • 宁波住房和城乡建设委员会官方网站2345网址导航下载桌面
  • dw做的网站怎么让别人看到泉州seo外包
  • 自助网站建设方法北京网站seo设计
  • 手机app制作开发郑州seo培训
  • 新浪网页baidu优化
  • 黄石百度做网站多少钱如何做网络推广推广
  • iis搭建网站怎么做前端站长seo工具
  • 靠谱的建筑工程险seo在线排名优化
  • 平台如何制作网站营销目标分为三个方面
  • 商业网站制作种子搜索引擎torrentkitty
  • 平顶山有做网站的公司大型网站制作
  • 网站开发bug云南疫情最新消息
  • 网站设计用什么软件武汉百度seo排名
  • 如何申请个人网站域名seo属于技术还是营销
  • 商城网站怎么优化百度云网盘资源分享网站
  • 长春网站建设sok网络推广运营优化
  • 有哪些好的做h5的网站希爱力双效片用后感受
  • 我看别人做系统就直接网站下载文件上海网站seoseodian
  • 福鼎网站建设bt磁力
  • wordpress 打开满长沙seo排名收费
  • 上海建设委员会官网站百度下载安装
  • 品牌型网站建设解决方案网站模板价格
  • wordpress cpu检查唐山seo排名优化
  • 全屏网站设计技巧app宣传推广方案
  • wordpress建站教程道一精准营销案例
  • 网站关键词优化代理谷歌推广怎么开户
  • 服装官网网站建设友情链接查询
  • 建立b2b企业网站黑帽seo之搜索引擎