Hi, just came across character escape sequences e.g
'\a' The "alert" character, `
`\b' Backspace,
`\f' Formfeed,
`\n' Newline,
`\r' Carriage return,
`\t' Horizontal tab,
`\v' Vertical tab, `

I can only get some of them (new line and horizontal tab) to work. Do you have to do something special, is it my compiler (Bloodshed) or am I being an idiot?
Do these get used very often apart from '\n' I have never come across these before.

I also came across these error decryptors (http://www.bdsoft.com/tools/stlfilt.html) which are free. Do most people use these? Is it worth me switching my compiler to get one or is it better to learn finding the errors yourself?

Recommended Answers

All 3 Replies

I can answer the first question.

#include<stdio.h>

int main()
{
    printf ("\a" ) ;
    printf ( "Hi This text will not be seen" ) ;
    printf ( "\rHi this text will be seen ofcourse" ) ;
    printf ( "\nThe last letter will be modified" ) ;
    printf ( "\bD" ) ;
    getchar( ) ;
}

I don't know if they are used. Even if perhaps in C. In C++ iomanip will be used I guess.

1st part additions: all these chars are control codes for hard copy consoles. Most of them works now (how funny! nostalgic speaker beep after \a). However "\r\n\t" triad is fully actual...

2nd part: it seems STLFilt is potentially useful tool. C++ template diagnostic messages look like nightmares, it's true. Try it then tell us, why not?..

I've used '\r' plenty of times to implement a little timer or progress indicator.
The '\b' unfortunately doesn't always work... but it should on all modern terminals and emulators.

The formfeed and vertical tab are carryovers from line printers. They used to be used a bit more with plain-text documents than they are today...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.