Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need sys(2007) in c#
Message
From
17/07/2014 11:20:01
John Baird
Coatesville, Pennsylvania, United States
 
 
To
17/07/2014 11:02:25
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 4.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01603909
Message ID:
01603914
Views:
97
>i'm doing some work in C# and need to have a working version of a method that correctly translates the sys(2007,"foo") to the same value in c# that it calculates using the built-in vfp method. does anyone have any ideas or code for sys(2007) in c#.
>
>here's the docs for the sys(2007) method in vfp
>
>http://msdn.microsoft.com/en-us/library/csfkkhcy(v=vs.80).aspx


also found this:

The algorithm used by Sys(2007) is as follows:


*********************************


static unsigned char ObjectCheckSum = 0;


//+----------------------------------------------------------------------
---- // // Function: CalcCkSum, private // // Synopsis: Calculates the
checksum for a general field. // // Arguments: [ptr] -- pointer to data
to calculate checksum on. // [cb] -- number of bytes in the buffer. //
// Modifies: ObjectCheckSum //
//-----------------------------------------------------------------------
----


LOCAL void CalcCkSum(void *ptr, long cb)
{
long cktemp = 0;
long cl = cb >> 2;
long *lp = (long *) ptr;
TEXT *cp;


while(cl--)
cktemp ^= *lp++;
cl = cb & 3; // Any remainder?
cp = (TEXT *)lp;
while(cl--)
cktemp ^= *cp++;


ObjectCheckSum ^= cktemp;
ObjectCheckSum ^= cktemp >> 8;
ObjectCheckSum ^= cktemp >> 16;
ObjectCheckSum ^= cktemp >> 24;
}

http://computer-programming-forum.com/2-vfp/ac93d844790b80c7.htm
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform