Welcome to Clarion Community Sign in | Join | Faq

Clarion 6 - General

Started by narainkarthak at 09-19-2008 2:54 AM. Topic has 4 replies.

Print Search
Sort Posts:    
   09-19-2008, 2:54 AM
narainkarthak is not online. Last active: 11/4/2008 9:05:44 PM narainkarthak

Top 50 Posts
Joined on 11-27-2007
Kerala,India
Posts 17
CRC Value
Reply Quote
Hi All,
 
I am having an application in clarion 6.3.I need to get the function/API for finding out the crc value of a particular file(*.*).This function should return the crc value on passing the entire path of the file.Can anyone help me on this?
 
 

Narayanan Kartha K,
Analyst Programmer,
CCS Technologies(P) Ltd.,
http://www.ccstechnologies.in

   Report 
   09-19-2008, 8:31 AM
Shankar is not online. Last active: 11/14/2008 4:04:22 PM Shankar

Top 10 Posts
Joined on 10-24-2005
Dubai, UAE
Posts 219
Re: CRC Value
Reply Quote
Hi Narain,

Load the file using the DOS database driver to a CSTRING/STRING variable and calculate the CRC checksum on the variable's contents. The CRC function is an internal function which you can embed into the Global Map as ::

MODULE('CLARION')
nkCRC32 (*STRING Buffer, USHORT Bytes, ULONG Start), ULONG, RAW, NAME('CLA$CRC32')
END

The usage would be ::

CRC_ChkSum = nkCRC32(<StringVar>, SIZE(<StringVar>), 0)


Regards

Shankar
   Report 
   09-19-2008, 9:03 AM
narainkarthak is not online. Last active: 11/4/2008 9:05:44 PM narainkarthak

Top 50 Posts
Joined on 11-27-2007
Kerala,India
Posts 17
Re: CRC Value
Reply Quote

Hi Shankar,

Thank you very much for your reply.I need to get a function which will return a differnt crc value if we change the content of that file.Could you please help me on this?


Narayanan Kartha K,
Analyst Programmer,
CCS Technologies(P) Ltd.,
http://www.ccstechnologies.in

   Report 
   09-19-2008, 11:52 PM
Shankar is not online. Last active: 11/14/2008 4:04:22 PM Shankar

Top 10 Posts
Joined on 10-24-2005
Dubai, UAE
Posts 219
Re: CRC Value
Reply Quote
Hi Narain,

CRC is not a perfect function for checking changes as it can return similar CRC for two files with different contents although the occurence is rare. You maybe use a MD5 Hash which return a 32 byte string value for better results and accuracy. Check www.clariondeveloper.com for examples on using MD5. The MD532.zip will be the better choice as it has a function to work on a file directly. So depending on whether the accuracy needs to be 100%, you decide whether to use CRC or MD5.
In summary, both CRC or MD5 will help you identify changes in file contents.

Regards

Shankar
   Report 
   09-21-2008, 10:26 PM
narainkarthak is not online. Last active: 11/4/2008 9:05:44 PM narainkarthak

Top 50 Posts
Joined on 11-27-2007
Kerala,India
Posts 17
Re: CRC Value
Reply Quote

 Hi Shankar,

Thanks again for your comments.We tried with the MD5.But we feels that it is also working on the basis of filename only.Not with the file content.We changed the file content but the md5 result remains the same.Could you please help me on this?


Narayanan Kartha K,
Analyst Programmer,
CCS Technologies(P) Ltd.,
http://www.ccstechnologies.in

   Report 
Clarion Communi... » Clarion » Clarion 6 - Gen... » CRC Value

Powered by Community Server, by Telligent Systems