Alltrim() don't work (from comp.databases.xbase.fox) 
Author Message
 Alltrim() don't work (from comp.databases.xbase.fox)

Florin,

The problem is that you are adding CHR(0) in your program in line :
thisform.cpassword=thisform.cpassword+chr(val(substr(thisform.npasswor
d,2*i-1,2)))

ALLTRIM() doesn't remove CHR(0) but will remove CHR(32).

I wish I could give you a better explanation of exactly what CHR(0) is
or why it's different from CHR(32), but I haven't found it yet.

I see that you are making an effort to "encrypt" the passwords.  You
might look at SYS(2007) which is a checksum.  It returns a 5-character
string of digits.  You could store VAL(SYS(2007, UPPER("MARIAN    "))
or something like that.

There is a nice encryption routine available at
http://www.*-*-*.com/
(free.)

--

Cindy Winegarden
Microsoft Certified Professional, Visual FoxPro

Duke Children's Information Systems
Duke University Medical Center



| Hi,
| I created a form to be used at login, where the user enters name and
| password.
| The problem appears (see the Click event of <OK> button) when I
compare the
| string entered by the user (thisform.tpass.value) with the string
obtained
| from the table where the names and pass are kept
(thisform.cpassword). I do
| not know why the ALLTRIM is not performed for THISFORM.CPASSWORD!!!
| To try, please input HELEN for user name and MARIAN for password.
You will
| see (in de{*filter*} for example) that it do not remove the trailing
blanks, so
| the comparison fails.
| I will attach a zip archive containing the form and the password
table
| (where the pass is kept using ASCII codes, that will be converted in
the
| valid clause of the pass textbox).
|
| Can anybody tell me that's wrong?
|
| Thank you,
| Florin Cherbis
|
|
|



Sat, 21 Dec 2002 03:00:00 GMT  
 Alltrim() don't work (from comp.databases.xbase.fox)

Quote:

> Florin,

> The problem is that you are adding CHR(0) in your program in line :
> thisform.cpassword=thisform.cpassword+chr(val(substr(thisform.npasswor
> d,2*i-1,2)))

> ALLTRIM() doesn't remove CHR(0) but will remove CHR(32).

> I wish I could give you a better explanation of exactly what CHR(0) is
> or why it's different from CHR(32), but I haven't found it yet.

Well, anyone who's spent any time coding in C can tell you...
Character ASCII 0 is the null character.  In C it is used
to terminate a string.  It is a non-printing character and
should not be confused with a space, a tab, or any other
"whitespace" character.  I've never found a need to use it in
FoxPro.

-- TRW



Sun, 22 Dec 2002 03:00:00 GMT  
 Alltrim() don't work (from comp.databases.xbase.fox)
Tim,

Yep - someone else explained the same thing to me.  Interesting thing
is that on the Character Map it describes CHR(0) as Keystroke:
Spacebar.

--

Cindy Winegarden
Microsoft Certified Professional, Visual FoxPro

Duke Children's Information Systems
Duke University Medical Center



| >
| > Florin,
| >
| > The problem is that you are adding CHR(0) in your program in line
:
| >
thisform.cpassword=thisform.cpassword+chr(val(substr(thisform.npasswor
| > d,2*i-1,2)))
| >
| > ALLTRIM() doesn't remove CHR(0) but will remove CHR(32).
| >
| > I wish I could give you a better explanation of exactly what
CHR(0) is
| > or why it's different from CHR(32), but I haven't found it yet.
|
| Well, anyone who's spent any time coding in C can tell you...
| Character ASCII 0 is the null character.  In C it is used
| to terminate a string.  It is a non-printing character and
| should not be confused with a space, a tab, or any other
| "whitespace" character.  I've never found a need to use it in
| FoxPro.
|
| -- TRW



Sun, 22 Dec 2002 03:00:00 GMT  
 Alltrim() don't work (from comp.databases.xbase.fox)


No. Cindy, that first character in the character map is 32, not 0. The
character map simply doesn't bother with characters below 32 since they
don't map to actual 'characters'.

Alan

Quote:
>Yep - someone else explained the same thing to me.  Interesting thing
>is that on the Character Map it describes CHR(0) as Keystroke:
>Spacebar.


(with a 'p' on 'alan' making it 'alanp',
and no spaces). I'm sick of email spam.


Sun, 22 Dec 2002 03:00:00 GMT  
 Alltrim() don't work (from comp.databases.xbase.fox)
Thanks Alan.

--

Cindy Winegarden
Microsoft Certified Professional, Visual FoxPro

Duke Children's Information Systems
Duke University Medical Center



| On Wed, 5 Jul 2000 19:22:34 -0400, "Cindy Winegarden"

|
| No. Cindy, that first character in the character map is 32, not 0.
The
| character map simply doesn't bother with characters below 32 since
they
| don't map to actual 'characters'.
|
| Alan
|
| >Yep - someone else explained the same thing to me.  Interesting
thing
| >is that on the Character Map it describes CHR(0) as Keystroke:
| >Spacebar.
|

| (with a 'p' on 'alan' making it 'alanp',
| and no spaces). I'm sick of email spam.



Mon, 23 Dec 2002 03:00:00 GMT  
 Alltrim() don't work (from comp.databases.xbase.fox)
I do work a lot with CHR(0) !!!! Because I work a lot with binary digit
stored in a byte ! For example bit 0 of BYTE 1 is 'POWER SUPPLY ON", bit 1
is "BRAKE OFF", bit 2 is "ON", .... if the machine is OFF because there is
no power supply and, because of that, brakes are on, .....

But as you said, CHR(0) is very well handled by Fox. I have only problem
because I mix C and Fox !

--

Pour comprendre la rcursivit, il faut d'abord comprendre la rcursivit



Tue, 24 Dec 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. URL's seen in comp.databases.xbase.fox

2. I lost my account (comp.databases.xbase.fox FAQ's)

3. Alltrim() don't work

4. comp.databases.xbase.fox

5. comp.databases.xbase.fox archivist WANTED

6. Sneakpeek explanation and summary for comp.databases.xbase.fox

7. SneakPeek summary for comp.databases.xbase.fox for 8/14/1998

8. Links Related To comp.databases.xbase.fox - FREE ACCESS 0228

9. Links Related To comp.databases.xbase.fox - FREE ACCESS 0226

10. Links Related To comp.databases.xbase.fox - FREE ACCESS

11. Links Related To comp.databases.xbase.fox - FREE ACCESS 0219

12. Links Related To comp.databases.xbase.fox - FREE ACCESS

 

 
Powered by phpBB® Forum Software