deleting characters

This is a discussion on deleting characters within the C Programming forums, part of the General Programming Boards category; I am making a simple animation function as part of a program. at the moment I use printf to print ...

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    3

    deleting characters

    I am making a simple animation function as part of a program.

    at the moment I use printf to print information
    and then use the'\b' character to delete it before starting again with the next set of data

    But the '\b' will not delete newline characters so the out put is not deleted.

    Is there and function or anything that can remove printed characters (includeing \ characters?)

    any help is appriciated
    scrasnu

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    There is no standard way to go back up on the screen.

    To "go back", you'd need a funciton like "gotoxy()" in Turbo C, which places the cursor at a defined X and Y coordinate point.

    This is not part of C/C++ standards, but rather specific to each OS/Compiler implementation.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Sep 2008
    Posts
    3
    Quote Originally Posted by matsp View Post
    This is not part of C/C++ standards, but rather specific to each OS/Compiler implementation.
    I have 'make' on linux AND miricle C on windows

    WHich library would that function be in

    also how whould I use it?

    Thanks for help

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    "make" on linux is not a compiler - you are probably using gcc.

    On Linux (and to some extent in Windows) you can use ANSI escape codes: http://en.wikipedia.org/wiki/ANSI_color

    In Windows, you can use SetConsoleCursorPosition (one of several Console Functions that can be found here:http://msdn.microsoft.com/en-us/libr...73(VS.85).aspx).

    Miracle C is not a good compiler from what I hear - you can get the same compiler as on Linux, gcc, in the gcc-mingw package, which is a high quality compiler [and with the added advantage of being very similar for both Linux and Windows, so you don't have to keep so many things in mind when moving from one to the other].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by robwhit View Post
    \b doesn't delete the text, it just repositions the cursor. To delete the previous character, output a \b and a space.
    Yes, but it also works to do "abc\b\b\bdef", and you will see "def" on the screen (and not like on an old typewriter, abc overwritten by def.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    bleugh you caught me before I realized that wasn't what the op was talking about.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 07-10-2008, 03:45 PM
  2. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  3. Deleting characters from 2d arrays
    By `firefox in forum C Programming
    Replies: 4
    Last Post: 05-21-2005, 05:18 PM
  4. Deleting characters from strings
    By mister_s in forum C Programming
    Replies: 8
    Last Post: 11-10-2004, 03:49 AM
  5. deleting invaid characters in a string
    By Granger9 in forum C Programming
    Replies: 11
    Last Post: 09-12-2002, 07:22 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21