Hello
In a C++ program, I would like to change the string
"ty^Hypescript ^H ^H^H ^H^H ^H^H ^H^H ^H^H ^H^H ^H^
^H^H ^H^H ^H^H ^H^G^G^G^G^Gty^Hypescript ^H ^H^H ^H^H ^H^H ^H^M"
into the string
"typescript"
The letters like '^H', '^H^H', and '^G' represents some of the ANSI control characters such as backspace. (the characters are shown on VI editor.
So, I think it's possible to process control characters within a code, like a VT100 virtual terminal does.( In deed, I am not sure whether the process is done in a terminal, shell or whatever.
If you have a sample code or a function to suggest, please post them. Thank you
mccoyn - 16 May 2004 02:06 GMT
void remove_ctrl_chars(char* dst, const char* src)
while (*src != '\0')
switch(*src)
case '\x07': break
case '\x08': break
case '\x13': break
default
*dst = *src
dst++
src++
http://msdn.microsoft.com/library/en-us/vccelng/htm/ascii_2.asp