一个读取配置文件的工具类,代码如下
Config.h
|
|
测试
config文件
|
|
test.cpp
|
|
结果
|
|
Get函数返回结果为一字符串,可通过atoX函数自行转化为相应的数据类型,如读取的为int类型,可用atoi函数转化等。
本文总阅读量 次
本文由 Yu Zhang 发表于 Yu Zhang's Blog ,采用署名-非商业性使用-禁止演绎 3.0进行许可。
非商业转载请注明作者及出处。商业转载请联系作者本人。
yuzhang2016@hust.edu.cn
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置:
jsonContent: meta: false pages: false posts: title: true date: true path: true text: false raw: false content: false slug: false updated: false comments: false link: false permalink: false excerpt: false categories: false tags: true