Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
174f2c1f
Commit
174f2c1f
authored
Jul 10, 2009
by
Jesse Beder
Browse files
Set up the parse utility program to read from standard input if no file is specified
parent
11f98f1c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
util/parse.cpp
util/parse.cpp
+10
-9
No files found.
util/parse.cpp
View file @
174f2c1f
...
...
@@ -4,16 +4,17 @@
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
!=
2
)
{
std
::
cout
<<
"Usage: "
<<
argv
[
0
]
<<
" input-file
\n
"
;
return
0
;
}
std
::
ifstream
fin
;
if
(
argc
>
1
)
fin
.
open
(
argv
[
1
]);
std
::
i
f
stream
fin
(
argv
[
1
]
);
std
::
istream
&
input
=
(
argc
>
1
?
fin
:
std
::
cin
);
try
{
YAML
::
Parser
parser
(
fin
);
YAML
::
Parser
parser
(
input
);
while
(
parser
)
{
YAML
::
Node
doc
;
parser
.
GetNextDocument
(
doc
);
}
}
catch
(
const
YAML
::
Exception
&
e
)
{
std
::
cerr
<<
e
.
what
()
<<
"
\n
"
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment