Solved

ASCII dec number for CTRL key

Posted on 2007-04-11
7
1,332 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 

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 51

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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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.

705 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