Character Escape Sequences (and Error Decryptors)

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 32
Reputation: coveredinflies is an unknown quantity at this point 
Solved Threads: 0
coveredinflies coveredinflies is offline Offline
Light Poster

Character Escape Sequences (and Error Decryptors)

 
0
  #1
Aug 6th, 2008
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?
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 334
Reputation: Prabakar is on a distinguished road 
Solved Threads: 29
Prabakar's Avatar
Prabakar Prabakar is offline Offline
Posting Whiz

Re: Character Escape Sequences (and Error Decryptors)

 
0
  #2
Aug 6th, 2008
I can answer the first question.

  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5. printf ("\a" ) ;
  6. printf ( "Hi This text will not be seen" ) ;
  7. printf ( "\rHi this text will be seen ofcourse" ) ;
  8. printf ( "\nThe last letter will be modified" ) ;
  9. printf ( "\bD" ) ;
  10. getchar( ) ;
  11. }

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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: Character Escape Sequences (and Error Decryptors)

 
0
  #3
Aug 6th, 2008
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?..
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,953
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Character Escape Sequences (and Error Decryptors)

 
0
  #4
Aug 6th, 2008
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...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC