Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   Re: C run time error in Tandem. (http://www.velocityreviews.com/forums/t956130-re-c-run-time-error-in-tandem.html)

Ken Brody 01-04-2013 03:59 PM

Re: C run time error in Tandem.
 
On 1/4/2013 12:33 AM, jk__c wrote:
> I get a run time error in the below sprintf when I try executing the c
> program in Tandem. This code is successfully compiled and tested in
> windows. I'm trying to convert an array of unsigned char to a char string
> using sprintf and it fails exactly at this line. If I replace sprintf
> with a normal printf("%02X",sha256sum[j]) in the below code also the same
> error occurs.


How do you know that the error occurs in the sprintf? What happens if you
remove the sprintf call entirely?

> ERROR
> -----------------------------------
> - *** Run-time Error 003 ***
> - Instruction failure
>
> CODE SNIPPET
> ------------------------------------
>
> unsigned char sha256sum[32];
> char converted[65];
> ....
> ....
>
> for( j = 0; j < 32; j++ )
> {
> sprintf(&converted[j*2],"%02X",sha256sum[j]);
> }


There's nothing wrong in the code you've posted, but it's quite possible
that something elsewhere is the actual cause of the problem.



All times are GMT. The time now is 01:24 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57