View Single Post
Old Dec 11th, 2005, 6:27 AM   #1
coldDeath
Expert Programmer
 
coldDeath's Avatar
 
Join Date: Aug 2005
Location: UK
Posts: 862
Rep Power: 4 coldDeath is on a distinguished road
Send a message via AIM to coldDeath Send a message via Yahoo to coldDeath
Post Linux - ASCII Code 27

I wrote this little program to show what I'm talking about:
[php]#include <iostream>

int main(int argc, char** argv)
{
std::cout<<char(27)<<std::endl;
return 0;
}[/php]

I'm using g++ to compile this, and when run it removes the first character of the next line in the terminal.

Example:
Quote:
Originally Posted by terminal
jack@slackbox:~/files/cpp$ g++ del.cpp -o del
jack@slackbox:~/files/cpp$ ./del

ack@slackbox:~/files/cpp$
Notice the missing "j" on the last line.

I was just wondering why it removed this character when printing the ASCII code for the escape key.

Can anyone enlighten me?


EDIT:
On further inspection, i found that if i remove the endl from the statement, the first character of the next line is not removed. This makes em even more confused as to why this is happening.
__________________
Join us at #programmingforums @ irc.freenode.net!

My software never has bugs. It just develops random features.
coldDeath is offline   Reply With Quote