mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Merged utf branch changes r178:187 into the trunk
This commit is contained in:
2
util/CMakeLists.txt
Normal file
2
util/CMakeLists.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
add_executable(parse parse.cpp)
|
||||
target_link_libraries(parse yaml-cpp)
|
21
util/parse.cpp
Normal file
21
util/parse.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "yaml.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if(argc != 2) {
|
||||
std::cout << "Usage: " << argv[0] << " input-file\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::ifstream fin(argv[1]);
|
||||
try {
|
||||
YAML::Parser parser(fin);
|
||||
YAML::Node doc;
|
||||
parser.GetNextDocument(doc);
|
||||
} catch(const YAML::Exception& e) {
|
||||
std::cerr << "Error at line " << e.line << ", col " << e.column << ": " << e.msg << "\n";
|
||||
}
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user