compile error :(



 DEVELOP > c-Plus-Plus > compile error :(

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "Paweł"
Date: 14 Jul 2003 02:51:42 AM
Object: compile error :(
void __fastcall TRabatyForm::Edit1iKeyPress(TObject *Sender, char &Key)
{
if((Key < '0') (Key > '9') Key = '#0';
}
Why? I need to filter alloed key do digits only.
Pawel
.

User: "Alf P. Steinbach"

Title: Re: compile error :( 14 Jul 2003 03:23:56 AM
On Mon, 14 Jul 2003 09:51:42 +0200, "Paweł" <koral21@poczta.onet.pl> wrote:

void __fastcall TRabatyForm::Edit1iKeyPress(TObject *Sender, char &Key)

Note that "__fastcall" is not standard C++.

{
if((Key < '0') (Key > '9') Key = '#0';

1. You need an operator between the two expressions.
Probably you meant "||".
2. Specifying more than one character between apostrophes
like in '#0' is an old C syntax for "magic" integer
values, but there isn't room in a char for that value.
Probably you meant something else. Like '\0'.

}

Why? I need to filter alloed key do digits only.

Have you considered 'isdigit'?
.
User: "Paweł"

Title: Re: compile error :( 14 Jul 2003 03:36:03 AM

Note that "__fastcall" is not standard C++.


{
if((Key < '0') (Key > '9') Key = '#0';


1. You need an operator between the two expressions.
Probably you meant "||".

yes, but i tried word " or " and there was an compile error


2. Specifying more than one character between apostrophes
like in '#0' is an old C syntax for "magic" integer
values, but there isn't room in a char for that value.
Probably you meant something else. Like '\0'.

U R right.


}

Why? I need to filter alloed key do digits only.


Have you considered 'isdigit'?

This helped. Thx.
Pawel
.
User: "Victor Bazarov"

Title: Re: compile error :( 14 Jul 2003 09:43:25 AM
"Jeremy Cowles" <jeremy.stop-spam-now.cowles@asifl.com> wrote...

"Paweł" <koral21@poczta.onet.pl> wrote in message
news:betq1f$mqc$1@news.onet.pl...

Note that "__fastcall" is not standard C++.


{
if((Key < '0') (Key > '9') Key = '#0';

There is a missing closing parenthesis after '9'.


1. You need an operator between the two expressions.
Probably you meant "||".



yes, but i tried word " or " and there was an compile error



AFAIK, keyword "Or" is not valid in C++ as a boolean operator (or any

other

operator for that matter).

You know wrong. "or", "and", "xor", "not" "not_eq", "and_eq",
"compl", "bitor", "bitand", "xor_eq", "or_eq", are reserved as
_alternative_ tokens for "||", "&&" , "^", "!", "!=", "&=",
"~", "|", "&", "^=", "|=", respectively.
If a compiler does not accept those, it's non-compliant.
Victor
.
User: "Jeremy Cowles"

Title: Re: compile error :( 14 Jul 2003 10:40:57 AM
"Victor Bazarov" <v.Abazarov@attAbi.com> wrote in message
news:vh5gdlqd4pmif2@corp.supernews.com...

"Jeremy Cowles" <jeremy.stop-spam-now.cowles@asifl.com> wrote...

"Paweł" <koral21@poczta.onet.pl> wrote in message
news:betq1f$mqc$1@news.onet.pl...

[snip]

yes, but i tried word " or " and there was an compile error



AFAIK, keyword "Or" is not valid in C++ as a boolean operator (or any

other

operator for that matter).


You know wrong. "or", "and", "xor", "not" "not_eq", "and_eq",
"compl", "bitor", "bitand", "xor_eq", "or_eq", are reserved as
_alternative_ tokens for "||", "&&" , "^", "!", "!=", "&=",
"~", "|", "&", "^=", "|=", respectively.

If a compiler does not accept those, it's non-compliant.

My fault (newb). Wierd that these were not mentioned in my book, or perhaps
they were & I just missed them.
Jeremy
.


User: "Alf P. Steinbach"

Title: Re: compile error :( 14 Jul 2003 03:41:17 AM
On Mon, 14 Jul 2003 10:36:03 +0200, "Paweł" <koral21@poczta.onet.pl> wrote:

Note that "__fastcall" is not standard C++.


{
if((Key < '0') (Key > '9') Key = '#0';


1. You need an operator between the two expressions.
Probably you meant "||".

yes, but i tried word " or " and there was an compile error


2. Specifying more than one character between apostrophes
like in '#0' is an old C syntax for "magic" integer
values, but there isn't room in a char for that value.
Probably you meant something else. Like '\0'.


U R right.


}

Why? I need to filter alloed key do digits only.


Have you considered 'isdigit'?

This helped. Thx.

You're welcome. Aside from C++ programming, the most common
error/oversight in doing what you're attempting is to forget
about _pasting_ of text into the control... Just a hint.
.




  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER