joe_Mclovin joe_Mclovin - 1 month ago 12
C++ Question

C++: Why does the same code run in Eclipse Neon produces different output in Visual Studio 2013?

I've been writing programs for my C++ class this semester and I have run into the problem a few times where I will write some code in Eclipse on my Mac and it does not give me the results I expect, or won't work at all. However, when I run the same exact code in class on a Windows machine with Visual Studio 2013 it works exactly as expected. An example of this is our last lab. One of the things that we had to do required us to use

std::cout << '\b';
, but this would not happen when I run the program on my Mac.

will not work on my Mac:

#include <iostream>
#include <iomanip>
using namespace std;

int main(void)
//Prints out header to console
cout << left << setw(20) << "Binary Number" << right << setw(20) << "Decimal Equivalent" << '\b' << endl;

return 0;

enter image description here

The code gives the same output without the backspace:

enter image description here

Does anyone know what could be causing this?


I edited this post to be more general with my example instead of specific to my project. This problem also came up for one of my classmates who was doing his C++ coding in XCode.


The Eclipse console does not support handling backspace.

There is a long standing bug report for this (Eclipse bug 76936) At one point there was a fix but it was reverted as it caused problems. So the current state is that it still that it doesn't work.