Thread: Forcing astring onto the same line

  1. #1
    Registered User
    Join Date
    Feb 2008

    Forcing astring onto the same line

    Hi I am new to this so forgive me if this has been asked but does anybody know a character similiar to the \n to force and output line back onto the line above. The problem I have is I am doing a user input followed by a comma followed by another user input co-ordinates obv, but it will only pull over 2 lines?e.g.
    enter next move?
    I am trying to force it on the same line but cannot anyone got any suggestions?

    Thanks Dave

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    You can never go backwards. But: in this case it appears to be the user's fault, not your fault. I mean, if you ask them to type "5,6" and they type "5[enter],6" there's nothing you can do about it.

  3. #3
    The larch
    Join Date
    May 2006
    You could probably use getline, parse that and "punish" the user unless they type things the way you like with prompting again, closing the program etc. That would not give them a choice but to enter things on the same line.

    But is it worth it?
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  4. #4
    Registered User
    Join Date
    Nov 2005
    if you are using windows you can make a gotoxy(int,int) function. This would allow you to go backwards, but it is obviously very platform dependent.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to do encryption in C
    By sankarv in forum C Programming
    Replies: 33
    Last Post: 12-28-2010, 11:01 AM
  2. Pointer and Polymorphism help.
    By Skyy in forum C++ Programming
    Replies: 29
    Last Post: 12-18-2008, 09:17 PM
  3. Printing Length of Input and the Limited Input
    By dnguyen1022 in forum C Programming
    Replies: 33
    Last Post: 11-29-2008, 04:13 PM
  4. Finding carriage returns (\c) in a line
    By JizJizJiz in forum C++ Programming
    Replies: 37
    Last Post: 07-19-2006, 05:44 PM