ifstream orgiVcf("/Users/zsl/---/project/vcfEdit/all.vcf", ios::in);
if(orgiVcf){
cout << "file is open" <<endl;
}
string result;
string temp;
string name;
int iTels = 0;
int iNumberFile = 0;
while (!orgiVcf.eof()) {
char szLine[256] = {0};
orgiVcf.getline(szLine, sizeof(szLine));
temp = szLine;
// if(temp.find("N:")!=string::npos
// && temp.find("BEGIN")==string::npos
// && temp.find("FN")==string::npos
// && temp.find("VERSION:")==string::npos){
// name.assign(temp,2,temp.length()-2);
// }else
if(string::npos != temp.find("TEL;")){
if(0 == iTels){
size_t pos = temp.find(":");
if(string::npos != pos
&& string::npos == temp.find("+86", pos+1)){
string oriPhone = temp.substr(pos+1, temp.length()-(pos+1));
temp.insert(pos+1, "+86");
temp += "\n";
temp += "TEL;TELEX:";
temp += oriPhone;
}
}
++iTels;
}
c++文件库编辑vcf文件
最新推荐文章于 2026-06-04 16:19:47 发布
本文介绍如何使用C++在Windows下编辑从Android手机导出的VCF联系人文件,主要内容是在每个电话号码前添加"+86"。由于文件在不同平台间的编码差异,仅处理内容修改,未涉及汉字编码转换。


2793

被折叠的 条评论
为什么被折叠?



