In C, is there a way to printf after scanf and return to the scanf?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ripedox
    New Member
    • Mar 2014
    • 2

    In C, is there a way to printf after scanf and return to the scanf?

    I am talking about something like this:
    Code:
    printf(".............");
    scanf();
    printf("............."):
    So the output would be:
    ............
    _
    ............

    "_" is where the user would input the value.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Can you not just display a \n as the last character in the printf above the scanf ?

    Comment

    • Ripedox
      New Member
      • Mar 2014
      • 2

      #3
      That would still make text appear above the scanf, not after it.

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        Can you not display a \n as the first character in the printf following the scanf?

        Comment

        • donbock
          Recognized Expert Top Contributor
          • Mar 2008
          • 2427

          #5
          Do you want to print out several lines and then scan input such that the echoed input appears in the middle of those printed lines?

          The generic name for this type of activity is cursor control. The C Standard does not provide a portable way to do this. You need a platform-specific library or you can embed platform-specific cursor control commands in your printf output. The examples I can provide reveal my age: curses or VT-100 control codes.

          Comment

          Working...