What does '\r' and '\b' mean? Please explain with example.
Answers were Sorted based on User's Feedback
Answer / ankita
\r is known as carriage return
e.g printf("ABC\rDE");
ABC.
then becoz of \r cursor comes back to the 1st char i.e here
A after that DE is there then finally it print
DEC with cursor on C.
\b is known as back literal
e.g. printf("ABC\bDE");
then ABC then finally ABDE will get printed.
| Is This Answer Correct ? | 63 Yes | 27 No |
Answer / brite
Even you are wrong Siva.
printf("ABC\rDE") will print DEC not DE.
| Is This Answer Correct ? | 32 Yes | 16 No |
Answer / siva
above two answers are wrong.
i tested the following is the correct answer
\r is known as carriage return
e.g printf("ABC\rDE");
DE will get printed.
\b is known as back literal
e.g. printf("ABC\bDE");
ABDE will get printed.
| Is This Answer Correct ? | 31 Yes | 21 No |
Answer / subh
Depends on terminal configuration
http://stackoverflow.com/questions/17236242/usage-of-b-and-r-in-c
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / mahboob ur rahman
System.out.print("mahboob\rkhan");
output:
mahboob
it will just priint mahboob
| Is This Answer Correct ? | 1 Yes | 13 No |
Answer / yogita
\r is used for carriage return and \b is used for computer
baep
| Is This Answer Correct ? | 18 Yes | 32 No |
Answer / v
printf("ABC\bDE");
It prints only "DE", because the printed ABC will be removed
by '\b'
| Is This Answer Correct ? | 11 Yes | 28 No |
What are c++ templates used for?
why v use c++ even we have microprocessor
What is the difference between a constructor and a destructor in C++?
List down the guideline that should be followed while using friend function.
What is problem with Runtime type identification?
What is the difference between ++ count and count ++?
What is input operator in c++?
What are the general quetions are in DEna bank manager IT/System interviews?
Can you Mention some Application of C/C++?
Read the following program carefully and write the output of the program. Explain each line of code according to given numbering. #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <errno.h> 1……………… int main (void) { pid_t pid; 2………………………… pid = fork(); 3…………………………. if (pid > 0) { int i; 4………………………… for (i = 0; i < 5; i++) { 5………………… …………… printf(" I AM VU : %d\n", i); 6………………… …………… sleep(1); } exit(0); } 7………………… ……… else if (pid == 0) { int j; for (j = 0; j < 5; j++) { 8……………………………… printf(" I have no child: %d\n", j); sleep(1); } _exit(0); } else { 9………………………………fprintf(stderr, "can't fork, error %d\n", errno); 10……………… … ………… exit (EXIT_FAILURE); } }
Which field is used in c++?
Can c++ do everything c can?