tests

tests,第1张

tests

#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:”< return value;
}
}
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);

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5504102.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-12
下一篇2022-12-12

发表评论

登录后才能评论

评论列表(0条)

    保存