Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - check for key entered

check for key entered

Discuss PocketC for Palm OS (including Desktop Edition)

check for key entered

Postby arcstrait on Thu Jan 17, 2008 4:21 am

Hi. I have been having trouble finding some way to locate a "\b" action. I'm asking especially how to check for simple backspace/delete. Neither "\b" nor '\b' have been working out, so we have used "\n" here in this sample semi-functional program. . .

First I'm checking char input.



Ok, I put this together in PocketC Desktop Edition just to make sure it compiles, but anything below the "@" marks can be used.


[[[[[--CUT--]]]]]]
@cid "YOUR";
@name "Key Dummy";
@dbname "kdummy";
@ver ".01";


int counter;
int acculen;

string accutemp;
string accu;

char cheque;

erase(){

acculen=(strlen(accu));
accutemp=strleft(accu,acculen-1);
accu=accutemp;

graph_on();
clearg();
text(5,55,accu);

} // end erase

main(){

graph_on();
clearg();

while (1) {
cheque = "";
cheque = wait();

if (cheque!="\n") {accu=accu+cheque;}
else {erase();}

text(5,15,accu);

} //end while

} //end Main

[[[[[===CUT===]]]]]
. . .

Simple but troubling. Then what if I want its ascii value? That would be
char(x), right? How would I go about writing a program to tell me what any particular char(x) entry refer to in ASCII?

Thanks.
arcstrait
 
Posts: 5
Joined: Thu Jan 17, 2008 1:15 am

Re: check for key entered

Postby dewey on Thu Jan 17, 2008 5:54 am

PocketC doesn't support the \b escape code. Instead, you can use \x08.
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Re: check for key entered

Postby arcstrait on Thu Jan 17, 2008 1:08 pm

dewey wrote:PocketC doesn't support the \b escape code. Instead, you can use \x08.



Dewey, Thanks :shock: Can you refer me to a list of such codes? :mrgreen:
arcstrait
 
Posts: 5
Joined: Thu Jan 17, 2008 1:15 am

Re: check for key entered

Postby dewey on Thu Jan 17, 2008 5:14 pm

The full list is at the bottom of the PocketC Language docs (Language-full.html).
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Re: check for key entered

Postby palmosm130 on Sat Oct 04, 2008 2:01 pm

Hi... I was looking to get this info also, but it's no longer there.
Kirk P Lawrence
palmosm130
 
Posts: 19
Joined: Fri May 27, 2005 1:51 am
Location: Canada

Re: check for key entered

Postby samps on Sat Oct 04, 2008 10:23 pm

They are at the end of the 'language' bit, just before the list of built-in functions. Look for 'Escape sequence'

Samps
Ubuntu user #82
samps
 
Posts: 143
Joined: Tue Feb 20, 2001 12:33 am
Location: Australia

Re: check for key entered

Postby palmosm130 on Mon Oct 06, 2008 7:06 am

Ah... I thought there would be more than what my book has provided having seen quite a number of source codes.

Special characters
There are two ways to add special characters to a string. The first is by appending them by number, such as:

str = "Here is a neat little square: " + (char)149;The other method is through using escape sequences. The following escape sequences are supported:

Escape sequence \\ \' \" \n \t \x
Interpretation \ ' " newline tab character specified by the following two hex digits. Example: '\x95' is the block character (decimal 149)

So, to create a string that contains a quote:

str = "She said \"I'm sorry,\" but it was too late...";
puts(str); // Prints: She said "I'm sorry," but it was too late...


Thank you
palmosm130
 
Posts: 19
Joined: Fri May 27, 2005 1:51 am
Location: Canada


Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 3 guests

cron