mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Merged utf branch changes r178:187 into the trunk
This commit is contained in:
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