Thread: something about printf (or maybe scanf)

  1. #1
    Addicted to the Internet netboy's Avatar
    Join Date
    Dec 2001
    Posts
    158

    Question something about printf (or maybe scanf)

    I need help. Is there any way I can make my output screen print out what I type in underlined?

    For example, for the word PROGRAMMING... When I type in the first character P, the P in the output screen will be underlined. THen when I finished typing everything, the word PROGRAMMING will be underlined.

    Anybody know how 2 do this?
    Thanks!
    It's unfulfilled dreams that keep you alive.

    //netboy

  2. #2
    Addicted to the Internet netboy's Avatar
    Join Date
    Dec 2001
    Posts
    158

    Smile

    FYI, I'm on Win XP. I've got 2 compiler here. 1 is the MS Visual C++ and the other one is the Borland 5.5 compiler...
    It's unfulfilled dreams that keep you alive.

    //netboy

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I dont think you can in console mode, but check here

    For windows GUI programs, there are all sorts of possibilities - the simplest is to use an underline font.
    As I'm not a windows programmer, you'd best ask again on the windows specific board.

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    You can create an underlined font with the windows API, but I'm not sure if it's possible in console applications. Look up the CHAR_INFO struct on msdn for further information if I recall correctly.

    -Prelude
    My best code is written with the delete key.

  5. #5
    ArgonLaser
    Guest

    Lightbulb This might be what you are trying to do.

    If you are doing this as an assignment for a computer science class. Here is what I did (make it simple):

    I made a copy of the string I was going to use and whenever it found the word(s) I was looking for it would replace it with an Underscore '_'. All the other letters were turned into spaces.

    Then I printed out the string. Then used a '\n' newline escape character. And then I printed out the underline(s).

    EXAMPLE: (supposing the word to find was "words")
    These are the words I was looking for these words!
    _____ _____

    This may not have been what you were trying to do but If it is, this might be helpful.

    Reguards,
    ArgonLaser

    PS. I know there are better ways to do this, but I did it a long time ago. I hope this helps.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. IF CONDITION plese help
    By birumut in forum C Programming
    Replies: 12
    Last Post: 03-06-2009, 09:48 PM
  2. making it portable.....?
    By ShadeS_07 in forum C Programming
    Replies: 11
    Last Post: 12-24-2008, 09:38 AM
  3. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  4. Simple C question: user input to repeat a loop
    By evernaut in forum C Programming
    Replies: 2
    Last Post: 11-18-2006, 09:23 AM
  5. Drawing tables in C
    By stanoman in forum C Programming
    Replies: 5
    Last Post: 10-09-2003, 10:14 AM