Thread: How to prevent cursor from going to newline in c++

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    22

    How to prevent cursor from going to newline in c++

    If you prompt a user to enter a value say;
    "Enter Salary: $"
    Then the user enters 500.00 and strikes the enter key.
    The cursor then goes to the next line.
    And this is what I want to prevent
    I don't want the cursor to go to a new line when the user hits enter. Or when it goes to a new line is there a way to get it back up to the previous line

  2. #2
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    I think its impossible using standard library. You should use platform specific functions.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  3. #3
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    431
    For a little more portability, you can use *curses.
    I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Searching for newline on the end of line text
    By LevelOne in forum C Programming
    Replies: 7
    Last Post: 03-03-2010, 04:36 AM
  2. getting rid of newline
    By AngKar in forum C Programming
    Replies: 24
    Last Post: 04-28-2006, 07:52 PM
  3. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  4. comparing int to newline character
    By RedZippo in forum C++ Programming
    Replies: 5
    Last Post: 05-13-2004, 06:37 PM
  5. fgets and a bothersome newline char
    By ivandn in forum Linux Programming
    Replies: 1
    Last Post: 11-14-2001, 01:41 PM