The first line does not have "..."
but a single character "…"
Change:
std::cout << "Connecting to hello world server…" << std::endl;
to
std::cout << "Connecting to hello world server..." << std::endl;
Domanda
I have a simple piece of example code
#include <string>
#include <stdio.h>
#include <iostream>
int main ()
{
std::cout << "Connecting to hello world server…" << std::endl;
printf ("Connecting to hello world server...\n");
while(true)
{
}
}
In the console window the first line prints the ellipses as an 'a' character with a tilde above it, where the second line prints as expected.
Can someone explain why this is happening?
Soluzione
The first line does not have "..."
but a single character "…"
Change:
std::cout << "Connecting to hello world server…" << std::endl;
to
std::cout << "Connecting to hello world server..." << std::endl;
Altri suggerimenti
Your first ellipses is a unicode horizontal ellipsis, whereas your second is three consecutive periods.
In the first one, you have a single character known as HORIZONTAL ELLIPSIS.
In the second, it is 3 period
s
As the others have explained, the first is using a single Unicode character NEXT LINE (NEL) (U+0085) while the second uses three periods.
As to why the first doesn't work, it's a limitation of the console window. It doesn't work in Unicode like the rest of Windows, it works with code pages. The numeric values of most characters will be completely different than their Unicode counterparts, so the wrong character will be printed.
In this case the \x85
character in Code page 437 is the à
that you see.