#include
#include
#include
#include
using namespace std;
String file_path = “./…/HikCameraPara.txt”; // 相机参数文件路径
// 读取相机参数文件
int readParaFile(int key) {
char buffer[256];
int num = 0;
int value;
ifstream in(file_path); // 生成根目录为可执行文件
if (! in.is_open()) // 使用默认参数表
{ cout << “Error opening file”;exit (1); }
while (!in.eof() )
{
num++;
in.getline (buffer,100);
if (key == num){ // 读取指定文件
cout << “sdfse:”<
}
}
in.close();
return value;
}
// 相机参数写入文件【相机调试模式下有效】
int writeParaFile(int key) {
fstream out(file_path); // 生成根目录为可执行文件
if (out.is_open())
{
out << “This is a line.”;
out << “This is another line.n”;
out.close();
}
else{
ofstream out_data;
out_data.open(file_path, ios::app);
out_data.close();
cout << “相机参数文件创建成功” << endl;
}
return 0;
}
readParaFile(2);



