YML示例代码
来源:互联网 发布:葫芦侠社区源码 编辑:程序博客网 时间:2024/04/27 16:30
#include <iostream>
#include <opencv2/opencv.hpp>
#include <time.h>
using namespace std;
using namespace cv;
int main()
{
FileStorage fs("test.yml", FileStorage::APPEND);
if(!fs.isOpened())
{
cout << "The file is not properly opened" << endl;
return 1;
}
time_t rawtime;
time(&rawtime);
fs << "logotime" << asctime(localtime(&rawtime));
fs << "class" << "class three";
fs << "chengji" << "[";
for(int i = 0; i < 5; i++)
{
int english;
int math;
int chinise;
cout << "english:";
cin >> english;
cout << "math:";
cin >> math;
cout << "chinise:";
cout << chinise;
fs << "{:" << "english" << english
<< "math" << math
<< "chinise" << chinise
<< "}";
}
fs << "]";
//fs.release();
cout << fs.releaseAndGetString() << endl;
fs.open("test.yml",FileStorage::READ);
FileNode top= fs.root(2);
switch(top.type())
{
case FileNode::NONE:
cout << "None" << endl;
break;
case FileNode::INT:
cout << "int" << endl;
break;
case FileNode::FLOAT:
cout << "float" << endl;
break;
case FileNode::STR:
cout << "str" << endl;
break;
case FileNode::REF:
cout << "ref" << endl;
break;
case FileNode::SEQ:
cout << "seq" << endl;
break;
case FileNode::MAP:
cout << "map" << endl;
break;
case FileNode::FLOW:
cout << "flow" << endl;
break;
case FileNode::USER:
cout << "user" << endl;
break;
case FileNode::EMPTY:
cout << "empty" << endl;
break;
case FileNode::NAMED:
cout << "named" << endl;
break;
default:
cout << "default" << endl;
break;
}
cout << (string)top["logotime"] << endl;
fs.release();
cout << "Hello Wolrd" << endl;
system("pause");
return 0;
}
#include <opencv2/opencv.hpp>
#include <time.h>
using namespace std;
using namespace cv;
int main()
{
FileStorage fs("test.yml", FileStorage::APPEND);
if(!fs.isOpened())
{
cout << "The file is not properly opened" << endl;
return 1;
}
time_t rawtime;
time(&rawtime);
fs << "logotime" << asctime(localtime(&rawtime));
fs << "class" << "class three";
fs << "chengji" << "[";
for(int i = 0; i < 5; i++)
{
int english;
int math;
int chinise;
cout << "english:";
cin >> english;
cout << "math:";
cin >> math;
cout << "chinise:";
cout << chinise;
fs << "{:" << "english" << english
<< "math" << math
<< "chinise" << chinise
<< "}";
}
fs << "]";
//fs.release();
cout << fs.releaseAndGetString() << endl;
fs.open("test.yml",FileStorage::READ);
FileNode top= fs.root(2);
switch(top.type())
{
case FileNode::NONE:
cout << "None" << endl;
break;
case FileNode::INT:
cout << "int" << endl;
break;
case FileNode::FLOAT:
cout << "float" << endl;
break;
case FileNode::STR:
cout << "str" << endl;
break;
case FileNode::REF:
cout << "ref" << endl;
break;
case FileNode::SEQ:
cout << "seq" << endl;
break;
case FileNode::MAP:
cout << "map" << endl;
break;
case FileNode::FLOW:
cout << "flow" << endl;
break;
case FileNode::USER:
cout << "user" << endl;
break;
case FileNode::EMPTY:
cout << "empty" << endl;
break;
case FileNode::NAMED:
cout << "named" << endl;
break;
default:
cout << "default" << endl;
break;
}
cout << (string)top["logotime"] << endl;
fs.release();
cout << "Hello Wolrd" << endl;
system("pause");
return 0;
}
0 0
- YML示例代码
- yml
- yml
- Docker部署步骤及“docker-compose.yml”文件示例
- xml和yml文件存储C风格代码
- 代码示例
- 代码示例
- 示例代码
- 示例代码
- database.yml
- bosh.yml
- cloudfoundry.yml
- database.yml
- springboot yml
- yml配置
- 不良代码示例和优良代码示例
- 天气代码调用代码示例
- 多线程示例代码
- 给UIViewController瘦身
- 迭代器和指针的区别以及迭代器失效
- ARM-----------arm-linux-gdb正确无错误安装
- Linux 自带的 watchdog 的简介
- android官方文档译文, 同步更新中(百度阅读免费领取)
- YML示例代码
- Replication in Kafka
- 文件复杂拷贝
- java8 lambda表达式-其他
- JNI头文件生成
- java 1.8 新特性
- javaweb-day02-3(XML 解析 - Dom4j解析开发包 - XPath)
- com.lowagie.text 导出数据为word文档
- 移动基于Percona XTRADB Cluster的大数据解决方案