tags:

views:

23

answers:

1

I've created a command line tool that parses JSON from reddit's front page. After being able to successfully list all of the submission titles; I want to be able to prompt and wait for numeric selection to go deeper into the post.

Btw, I'm fairly new to the language and I'm creating this for fun. I don't really know how to even properly ask this question because I've never developed for a compiler. I'm not really looking for a working solution. An ideal answer would be "..hey check out [methodName] and don't forget to import 'someClass.h'... " would be perfect.

+2  A: 

What about plain ol' C:

int selection;
do
{
    fseek(stdin, 0, SEEK_END);
    printf("Select and ID: ");
}
while (scanf("%i", &selection) == 0);

Sorry that I have no method for you to check out. However, you may at your discretion read the man page for scanf (and for fseek, now that I added it— sorry for the non-working snippet earlier!). If you want a small exercise, try to find out why it's necessary to have the fseek call.

Though don't forget to #include <stdio.h>.

zneak
You are awesome! Thanks :)
ryan