Input Preservation

This is a discussion on Input Preservation within the C Programming forums, part of the General Programming Boards category; I'm writing a real-time text adventure. However, there is one problem that never ceases to annoy me: the fact that ...

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    6

    Question Input Preservation

    I'm writing a real-time text adventure. However, there is one problem that never ceases to annoy me: the fact that whenever output is printed, it overwrites the line with the user's input.

    Does anyone know how to keep the bottom line untouched and reserved for input? Or at least make it appear to be one of those?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    What you need to do if you want a "split screen" is to write your own scroll routines to move the text within each section of the screen separately. You may be able to do that in a way that just uses the standard Windows or ncurses API - not sure, but the concept is pretty straight forward: copy the text up one line and reprint. Are you working on Windows or Linux (or something else)?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jul 2008
    Posts
    6
    I'm using Mac OS X Leopard, but writing in C for maximum cross-compatibility.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Ok, so you probably want to look into using ncurses then, as that's the library for Linux/Unix/MacOS development. There's a PDCurses for Windows that I've heard good things about too. I'm not sure how you tell ncurses to "delete one line at the top, insert one at line Y" (where Y is less than the whole height of the terminal window).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Jul 2008
    Posts
    6
    Thanks for the help. I'll look into it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. continues input
    By Matty_Alan in forum C Programming
    Replies: 2
    Last Post: 06-22-2007, 11:04 PM
  2. Input statement problem
    By une in forum C Programming
    Replies: 3
    Last Post: 05-30-2007, 12:16 AM
  3. For loop problems, input please.
    By xIcyx in forum C Programming
    Replies: 2
    Last Post: 04-22-2007, 04:54 AM
  4. Simple Console Input for Beginners
    By jlou in forum C++ Programming
    Replies: 0
    Last Post: 06-21-2005, 02:50 PM
  5. Help with Input Checking
    By Derek in forum C Programming
    Replies: 7
    Last Post: 06-17-2003, 04:07 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21