Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding simple-parse example #214

Merged
merged 2 commits into from Dec 30, 2014
Merged

adding simple-parse example #214

merged 2 commits into from Dec 30, 2014

Conversation

rdpoor
Copy link
Contributor

@rdpoor rdpoor commented Dec 26, 2014

In partial response to #133, I've created examples/simple_parse.c, a simple standalone program that parses a line of text into a json_t structure and prints it. (As a by-product, simple_parse.c has a print_json() method that recursively walks and prints a json_t object.)

What's missing is a makefile for the example directory and extensions to the other makefiles -- I'm not familiar enough with CMake or Makefile.am to confidently create them.

printf("Type some JSON > ");
fflush(stdout);

return getline(line, &len, stdin);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getline() isn't the best function to be used here because it's not portable. How about simply using fgets()?

@akheron
Copy link
Owner

akheron commented Dec 29, 2014

Otherwise looks good. I'll create the required makefiles once this is merged.

@rdpoor
Copy link
Contributor Author

rdpoor commented Dec 29, 2014

Thanks for the comments. Just updated the pull request with your suggested changes.

@rdpoor
Copy link
Contributor Author

rdpoor commented Dec 29, 2014

Note to self (though @akheron may find this marginally useful):

g++ -x c -Wall -I ${BUILD_ROOT}/include -L ${BUILD_ROOT}/lib examples/simple_parse.c -o examples/simple_parse -ljansson

akheron added a commit that referenced this pull request Dec 30, 2014
adding simple-parse example
@akheron akheron merged commit 970c698 into akheron:master Dec 30, 2014
@akheron
Copy link
Owner

akheron commented Dec 30, 2014

Merged, thanks!

@rdpoor
Copy link
Contributor Author

rdpoor commented Jan 2, 2015

Pleased to help. jansson is a great tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants