Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #15922

Re: Tree implementation, ideas for keyboard input method needed

From jgk@panix.com (Joe keane)
Newsgroups comp.lang.c
Subject Re: Tree implementation, ideas for keyboard input method needed
Date 2012-01-18 21:21 +0000
Organization Public Access Networks Corp.
Message-ID <jf7d3t$r9n$1@reader1.panix.com> (permalink)
References <Xns9FDCEA347419Bbubbachipsetone@130.133.4.11>

Show all headers | View raw


In article <Xns9FDCEA347419Bbubbachipsetone@130.133.4.11>,
Bubba  <nickname@banelli.biz.invalid> wrote:
>Now I need a sane way to input a tree from keyboard. What would be the 
>easiest one?

Like this?

int user_edit(struct tree *tree)
{
    ...
    for (;;)
    {
	...
	fputs("Command? [acdlsq] ");
	fflush(stdout);
	fgetstnl(cmd, sizeof cmd, stdin);
	c = cmd[0];

	switch (c)
	{
	  case 'a':

	    fputs("Key? ", stdout);
	    fflush(stdout);
	    fgetstnl(key, sizeof key, stdin);
	    fputs("Data1? ", stdout);
	    fflush(stdout);
	    fgetstnl(data1, sizeof data1, stdin);
	    err = add_node(tree, key, data1);
	    break:
	    ...
	  case 'l':
	    fputs("Filename? ", stdout);
	    fflush(stdout);
	    fgetstnl(filename, sizeof filename, stdin);
	    err = load_tree(tree, filename);
	    break;
	    ...
	  case 'q':
	    goto done;
	}

	if (err != 0)
	    fprintf(stdout, "Error: your command failed (%d)\n", err);
	...
    }
    ...
}

Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Tree implementation, ideas for keyboard input method needed Bubba <nickname@banelli.biz.invalid> - 2012-01-16 22:01 +0000
  Re: Tree implementation, ideas for keyboard input method needed Keith Thompson <kst-u@mib.org> - 2012-01-16 14:27 -0800
    Re: Tree implementation, ideas for keyboard input method needed Bubba <nickname@banelli.biz.invalid> - 2012-01-16 22:36 +0000
      Re: Tree implementation, ideas for keyboard input method needed Kaz Kylheku <kaz@kylheku.com> - 2012-01-16 22:53 +0000
      Re: Tree implementation, ideas for keyboard input method needed James Kuyper <jameskuyper@verizon.net> - 2012-01-16 18:06 -0500
      Re: Tree implementation, ideas for keyboard input method needed Keith Thompson <kst-u@mib.org> - 2012-01-16 16:41 -0800
    Re: Tree implementation, ideas for keyboard input method needed Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-01-16 23:01 +0000
      Re: Tree implementation, ideas for keyboard input method needed Shao Miller <sha0.miller@gmail.com> - 2012-01-16 19:49 -0500
        Re: Tree implementation, ideas for keyboard input method needed Keith Thompson <kst-u@mib.org> - 2012-01-16 17:46 -0800
  Re: Tree implementation, ideas for keyboard input method needed Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-01-16 22:29 +0000
    Re: Tree implementation, ideas for keyboard input method needed Bubba <nickname@banelli.biz.invalid> - 2012-01-16 22:38 +0000
    Re: Tree implementation, ideas for keyboard input method needed William Ahern <william@wilbur.25thandClement.com> - 2012-01-16 15:30 -0800
      Re: Tree implementation, ideas for keyboard input method needed Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-01-17 00:03 +0000
      Re: Tree implementation, ideas for keyboard input method needed Keith Thompson <kst-u@mib.org> - 2012-01-16 16:35 -0800
        Re: Tree implementation, ideas for keyboard input method needed cri@tiac.net (Richard Harter) - 2012-01-17 02:00 +0000
          Re: Tree implementation, ideas for keyboard input method needed Keith Thompson <kst-u@mib.org> - 2012-01-16 19:16 -0800
            Re: Tree implementation, ideas for keyboard input method needed cri@tiac.net (Richard Harter) - 2012-01-17 05:15 +0000
              Re: Tree implementation, ideas for keyboard input method needed Keith Thompson <kst-u@mib.org> - 2012-01-17 00:00 -0800
          Re: Tree implementation, ideas for keyboard input method needed Kaz Kylheku <kaz@kylheku.com> - 2012-01-17 04:04 +0000
  Re: Tree implementation, ideas for keyboard input method needed Kaz Kylheku <kaz@kylheku.com> - 2012-01-16 22:44 +0000
  Re: Tree implementation, ideas for keyboard input method needed Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-01-16 17:58 -0500
  Re: Tree implementation, ideas for keyboard input method needed ImpalerCore <jadill33@gmail.com> - 2012-01-16 19:36 -0800
    Re: Tree implementation, ideas for keyboard input method needed Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-01-16 23:33 -0500
      Re: Tree implementation, ideas for keyboard input method needed ImpalerCore <jadill33@gmail.com> - 2012-01-17 07:18 -0800
    Re: Tree implementation, ideas for keyboard input method needed "BartC" <bc@freeuk.com> - 2012-01-17 13:54 +0000
      Re: Tree implementation, ideas for keyboard input method needed ImpalerCore <jadill33@gmail.com> - 2012-01-17 07:39 -0800
    Re: Tree implementation, ideas for keyboard input method needed Kaz Kylheku <kaz@kylheku.com> - 2012-01-17 19:01 +0000
  Re: Tree implementation, ideas for keyboard input method needed jgk@panix.com (Joe keane) - 2012-01-18 21:21 +0000

csiph-web