Solved

ASCII dec number for CTRL key

Posted on 2007-04-11
7
1,306 Views
Last Modified: 2008-02-01
Can anyone tell me what is the ASCII decimal number for the control key? Or how to simulate it when sending a command to a process created with proc_open? Thanks.
0
Comment
Question by:submissiontechnology
7 Comments
 
LVL 24

Expert Comment

by:glcummins
ID: 18890843
Control is a modifier key, so I don't believe it has it's own number. Only when combined with another key does it gain an identifier.
0
 

Author Comment

by:submissiontechnology
ID: 18890878
I see. How can I send it to the process then?
0
 
LVL 48

Expert Comment

by:hernst42
ID: 18890898
If you want to send signals to the open process use proc_terminate http://www.php.net/manual/en/function.proc-terminate.php
CRTL-C is typical converted to SIG-TERM when used from the shell so sendig it's ascii code will not be enough.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:submissiontechnology
ID: 18890926
I actually need to send CTRL-A followed by D (to detach screen)
0
 
LVL 48

Expert Comment

by:hernst42
ID: 18891251
why not start screen directly in detached mode via
screen -m -d cmd to execute
0
 
LVL 50

Accepted Solution

by:
Steve Bink earned 500 total points
ID: 18892193
Historically speaking, control code characters are the first 26 ascii characters.  In other words, Ctrl-A is 1, Ctrl-B is 2, Ctrl-M is 13, Ctrl-Z is 26, and so on.  This has been standardized for some time, so you may just be able to add the ascii code directly into the command string.

I also know that *ix allows for control codes to be entered directly on the command line by pressing ctrl-v first.  So to enter a Ctrl-C, you would actually type Ctrl-V,Ctrl-C.
0
 

Author Comment

by:submissiontechnology
ID: 18896456
Thanks routinet chr(1) did the trick.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now