views:

1622

answers:

3

If I press ctrl-b that ought to give me ASCII code 2, but ctrl-c is going to be interpreted as a Break.

So I figure I've got to redirect a file in. How do I get these characters into a file?

+1  A: 

perl -e 'print "\xFF"', where FF is the hex code of the ACSII code you want to print. So for ACSII code 2, it would be \x02.

Steve M
+3  A: 
echo $'\002\003' > ./myfile
Daniel Fone
+7  A: 

Ctrl-V escapes the next keystoke. That's how you can get a Ctrl-C out: Ctrl-V Ctrl-C

Josh
this also works in Vi/Vim editors too
ShoeLace