Thread: Scanf Question

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    8

    Scanf Question

    By default,when you put a Scanf,then you run and enter the data,after that,you press ENTER,so the result jump the next line,my question is:After I typed the data,I want the result show in same line,so how can I do that?

    Thanks for helping.

  2. #2
    Registered User Draco's Avatar
    Join Date
    Apr 2002
    Posts
    463
    I don't really ever use scanf() so I don't know if it always goes to the next line. If it does, you can use gotoxy() to move the cursor back up to the next line and then display your information.

  3. #3
    zsaniK Kinasz's Avatar
    Join Date
    Jan 2003
    Posts
    222
    Im not real sure why but scanf doesnt go to the next line on my compiler. I am using dev++ at the moment for windows.

    When I was using gcc (with redhat7.3) the scanf did always go to the next line

    maybe they have changed it with the new C99 standard?
    "Assumptions are the mother of all **** ups!"

  4. #4
    Registered User Vber's Avatar
    Join Date
    Nov 2002
    Posts
    807
    I don't understand you, after you pressed ENTER, what scanf() supposed to do? hmm, can you show us the code?

  5. #5
    Registered User Cela's Avatar
    Join Date
    Jan 2003
    Posts
    362
    >>after that,you press ENTER,so the result jump the next line
    Not really, scanf doesn't know or care about lines, it just reads a stream of characters. What you're talking about is how the cursor on the command line has a line feed when you hit enter after typing something, this has nothing to do with scanf or your program.
    *Cela*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. scanf() question.
    By apacz in forum C Programming
    Replies: 12
    Last Post: 09-27-2006, 10:18 AM
  2. Replies: 7
    Last Post: 05-25-2006, 12:51 PM
  3. Exam Question - Possible Mistake?
    By Richie T in forum C++ Programming
    Replies: 15
    Last Post: 05-08-2006, 03:44 PM
  4. Simple question with scanf()
    By MadStrum! in forum C Programming
    Replies: 3
    Last Post: 01-20-2003, 10:41 AM
  5. Very simple question, problem in my Code.
    By Vber in forum C Programming
    Replies: 7
    Last Post: 11-16-2002, 03:57 PM