By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,918 Members | 2,246 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,918 IT Pros & Developers. It's quick & easy.

TAB displayed differently ?

P: n/a
Why is it, when you compile and run these using Visual Studio 2005,
the escape sequence is displayed diffently ?

The first one is displayed with a TAB lenght of 4 space charaters,
while the second is only displayed with the TAB length of 2 space
characters ?

std::cout << "Before one TAB escape sequence |\t| after one TAB
escape sequence." << std::endl;

std::cout << "Before one TAB escape sequence\tafter the TAB escape
sequence." << std::endl;
Feb 25 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
MrNewsReader wrote:
Why is it, when you compile and run these using Visual Studio 2005,
the escape sequence is displayed diffently ?

The first one is displayed with a TAB lenght of 4 space charaters,
while the second is only displayed with the TAB length of 2 space
characters ?

std::cout << "Before one TAB escape sequence |\t| after one TAB
escape sequence." << std::endl;

std::cout << "Before one TAB escape sequence\tafter the TAB escape
sequence." << std::endl;
Effects of outputting special characters is platform-specific. Why
don't you ask about those in a Windows programming newsgroup?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Feb 25 '07 #2

P: n/a
On Sun, 25 Feb 2007 14:20:18 -0500, "Victor Bazarov"
<v.********@comAcast.netwrote:
>MrNewsReader wrote:
>Why is it, when you compile and run these using Visual Studio 2005,
the escape sequence is displayed diffently ?

The first one is displayed with a TAB lenght of 4 space charaters,
while the second is only displayed with the TAB length of 2 space
characters ?

std::cout << "Before one TAB escape sequence |\t| after one TAB
escape sequence." << std::endl;

std::cout << "Before one TAB escape sequence\tafter the TAB escape
sequence." << std::endl;

Effects of outputting special characters is platform-specific. Why
don't you ask about those in a Windows programming newsgroup?

V
hmm...Windows programming newsgroup...you mean like MFC and such ?
This C++ code, is just made for the console window, but I haven't
posted the whole code ;-)

MrNewsReader
Feb 25 '07 #3

P: n/a
MrNewsReader wrote:
On Sun, 25 Feb 2007 14:20:18 -0500, "Victor Bazarov"
<v.********@comAcast.netwrote:
>MrNewsReader wrote:
>>Why is it, when you compile and run these using Visual Studio 2005,
the escape sequence is displayed diffently ?

The first one is displayed with a TAB lenght of 4 space charaters,
while the second is only displayed with the TAB length of 2 space
characters ?

std::cout << "Before one TAB escape sequence |\t| after one TAB
escape sequence." << std::endl;

std::cout << "Before one TAB escape sequence\tafter the TAB escape
sequence." << std::endl;

Effects of outputting special characters is platform-specific. Why
don't you ask about those in a Windows programming newsgroup?

V

hmm...Windows programming newsgroup...you mean like MFC and such ?
No, I don't mean like MFC and such. I mean a Windows programming NG.
This C++ code, is just made for the console window, but I haven't
posted the whole code ;-)
There is no such concept as "console window" in C++. If you cannot
ask your question without involving that, you're stuck with platform-
specificity. The list of newsgroups to consider is in in the FAQ.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Feb 25 '07 #4

P: n/a
In article <gn********************************@4ax.com>,
Mr**********@GoFigure.com says...
Why is it, when you compile and run these using Visual Studio 2005,
the escape sequence is displayed diffently ?

The first one is displayed with a TAB lenght of 4 space charaters,
while the second is only displayed with the TAB length of 2 space
characters ?

std::cout << "Before one TAB escape sequence |\t| after one TAB
escape sequence." << std::endl;

std::cout << "Before one TAB escape sequence\tafter the TAB escape
sequence." << std::endl;
As has already been mentioned, the effects are platform-specific.

That said, in many implementations, a tab aligns output to a multiple of
some number of character cells (e.g. 8). In such a case, a tab will
display as a variable amount of space, depending upon the alignment up
to that point.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Feb 25 '07 #5

P: n/a
On Sun, 25 Feb 2007 13:46:59 -0700, Jerry Coffin <jc*****@taeus.com>
wrote:
>In article <gn********************************@4ax.com>,
Mr**********@GoFigure.com says...
>Why is it, when you compile and run these using Visual Studio 2005,
the escape sequence is displayed diffently ?

The first one is displayed with a TAB lenght of 4 space charaters,
while the second is only displayed with the TAB length of 2 space
characters ?

std::cout << "Before one TAB escape sequence |\t| after one TAB
escape sequence." << std::endl;

std::cout << "Before one TAB escape sequence\tafter the TAB escape
sequence." << std::endl;

As has already been mentioned, the effects are platform-specific.

That said, in many implementations, a tab aligns output to a multiple of
some number of character cells (e.g. 8). In such a case, a tab will
display as a variable amount of space, depending upon the alignment up
to that point.
Hi Jerry

Thanks for your reply !
I have searched around to find a Windows programming newsgroup like
Victor mentioned, but I can't seem to find one. Do you have some
specific newsgroup in mind, where such a question is valid ?

Thanks
MrNewsReader
Feb 25 '07 #6

P: n/a
MrNewsReader wrote:
I have searched around to find a Windows programming newsgroup like
Victor mentioned, but I can't seem to find one. Do you have some
specific newsgroup in mind, where such a question is valid ?
Section 5.9 of this group's FAQ gives a list of newgroups tangentially
related to C++, and what is topical in each.

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

--
Alan Johnson
Feb 25 '07 #7

P: n/a
MrNewsReader wrote:
The first one is displayed with a TAB lenght of 4 space
charaters, while the second is only displayed with the
TAB length of 2 space characters ?
Assume a tab size of 8 characters and assuming you
are reading this reply with a mono-spaced font.

This gives the following tab stops :

T T T T T

Now line these up with your output:

T T T T T
Before one TAB escape sequence | | after one TAB escape
sequence.

T T T T T
Before one TAB escape sequence after the TAB escape sequence.

By definition the tab character will move to the next tab stop.
Notice
how this can create a tab of differing length.
I have searched around to find a Windows programming
newsgroup like Victor mentioned, but I can't seem to
find one.
Try comp.os.ms-windows.programmer.win32

Jussi Jumppanen
Author: Zeus for Windows IDE
http://www.zeusedit.com

Feb 26 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.