Jump to content
Tuts 4 You

Microsoft Fox Pro 9


Recommended Posts


i need to understand this line of foxpro 9.0 code:

serial = VAL(SYS(2007, ALLT(STR(THISFORM.TEXT1.VALUE)))) * 2

1) it takes the string from text1 :STR(THISFORM.TEXT1.VALUE)

2) it removes all spaces using ALLT

3) it generates the crc of the string withput spaces

4) and multiplys it by 2

msdn about the sys(2007, xxx) function:


and the val() function:


an example:

text1.value = "1 234"

-> remove spaces: "1234"

-> calc crc32b (??) 596A3B55

-> take first numbers: 596

-> mul by two: 1192

But what crc is used?

And what if the crc starts with a char, e.g. deepzero - F94E6C43

Is all this actually correct?

:help :help

Link to comment

CRC32B is used:

And yes, all of that is correct.

Edited by GaBoR
Link to comment


I might be wrong as I have no knowledge at all of Fox Pro.

But where does it state that that SYS(2007) function returns the checksum in hex?

It would make more sense that the sys function returns a base 10 string, and thus you wouldn't have the problem with the serial being 0 in almost 50% of the cases of the text1 value.

So convert your base16 number to a base10 one and then multiply it by two.



Link to comment


till, you`re right, it retrunsa decimal b10 value! :flowers:

It`s using crc16 though. :)

thanks you two!

dp0 :)

Edited by deepzero
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...