| | |
Character Escape Sequences (and Error Decryptors)
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2008
Posts: 32
Reputation:
Solved Threads: 0
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?
'\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?
I can answer the first question.
I don't know if they are used. Even if perhaps in C. In C++ iomanip will be used I guess.
c Syntax (Toggle Plain Text)
#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.
Last edited by Prabakar; Aug 6th, 2008 at 1:21 pm.
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?..
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...
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...
![]() |
Other Threads in the C++ Forum
- Previous Thread: Need Help with a question
- Next Thread: Numerical Computation/Need for interpolation subroutine(akima spline)
| Thread Tools | Search this Thread |
Tag cloud for C++
api array arrays based beginner binary bmp c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete deploy directshow dll download dynamic dynamiccharacterarray encryption error file format forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib library linkedlist linker list loop looping loops map math matrix memory microsoft newbie news number output pointer problem program programming project python random read recursion recursive reference rpg simple string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






