Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange occurence of string "Putty"

Tags:

c

putty

I am running a C program using putty (don't ask why) and it is working fine, except when I run a particular function, the string "PuTTy" appears at the end. This doesn't seem to be affecting anything much, but I am just curious if anyone knows why this is happening and what sort of error this might indicate.

Note: When I run the code in a Linux terminal, there is no error whatsoever.

like image 315
Scranton Avatar asked Aug 20 '12 14:08

Scranton


1 Answers

This is an issue with PuTTY caused by your program emitting the Control-E character. From the PuTTY FAQ:

A.7.12 When I cat a binary file, I get ‘PuTTYPuTTYPuTTY’ on my command line.

Don't do that, then.

This is designed behaviour; when PuTTY receives the character Control-E from the remote server, it interprets it as a request to identify itself, and so it sends back the string ‘PuTTY’ as if that string had been entered at the keyboard. Control-E should only be sent by programs that are prepared to deal with the response. Writing a binary file to your terminal is likely to output many Control-E characters, and cause this behaviour. Don't do it. It's a bad plan.

To mitigate the effects, you could configure the answerback string to be empty (see section 4.3.7); but writing binary files to your terminal is likely to cause various other unpleasant behaviour, so this is only a small remedy.

Is your function outputting binary characters such as Control-E?

like image 125
Robert Gamble Avatar answered Sep 30 '22 12:09

Robert Gamble