Dear VIKAS,
Let me tell you what the \r does in the statement Console.Write("This is
First Line \r and This is Second");
When the static class method Write is called, it writes the first part of
your string on the screen i.e. This is First Line, then it reaches the \r which
tells the cursor return back to the beginning position of the same line, then
it goes on witting the renaming part of the string which overwrites on the
screen what was written previously. Thus you always see the second part of
the string after the escaping character \r.
I have commented on your email below see what is written in bold and red
below.
To demonstrate what happens really, you can test with the following by
making following changes to your code to have a shorter string on the second
part. Lets try this, replace the following on your code that displays to the
screen.
Console.Write("This is First Line \r and Second");
Run the program after making the above change to your code, then the out put
of the program will be the following
and Secondst Line
The string in black comes from the first string before \r, and the string in
red comes from the second part that overwrites the first.
If this is not clear please do not hesitate to ask me further.
Red
On Fri, Nov 7, 2008 at 8:10 AM, VIKAS GARG <[EMAIL PROTECTED]> wrote:
> Thanks Rediat for the work you had done to make my concepts clear reading
> what /r is.It sends the cursor position to the beginning of the next line.
> [Not to the beginning of the next line, rather to the beginning of the
> same line, that is why it over writes it]
>
> But I am still having one confusion with /r
> that is when we use
> Console.Write("This is First Line \r and This is Second");
> Then the output comes
> " and This is Second"
> Why is it truncating the part of the output. It is sending the cursor to
> the second line's beginning then what happens to the part which was printed
> in the first line
>