以下是WINDOWS环境下的完整程序。
下面是头文件
。
#include <stdio.h>
#include <unistd.h>
#include <dirent.h>
#include <iostream>
#include <string>
#include <string.h>
#include <io.h>
using namespace std;
下面是字符串替换函数
。
/* 功 能:将str字符串中的oldstr字符串替换为newstr字符串
* 参 数:str:操作目标 oldstr:被替换者 newstr:替换者
* 返回值:返回替换之后的字符串
* 版 本: V0.2
* 参考链接:https://blog.csdn.net/qq_41673920/article/details/81390972
*/
char *strrpc(char *str, char *oldstr, char *newstr)
{
char bstr[strlen(str)]; //转换缓冲区
memset(bstr, 0, sizeof(bstr));
for (int i = 0; i < strlen(str); i++