hello, I'm using gambas 2.8 on debian and I'm getting different result when debugging code ( the result is a md5 hash string (32 characters)) but no when executing in a normal way. The error is
Failed to set text from markup due to error parsing markup: Error on line 1 char 10: Invalid UTF-8 encoded text - not valid '�$R ���\u0002}60b725f10c9c85c70d97880dfe8191b3' The correct result is string 60b725f10c9c85c70d97880dfe8191b3 sometimes I get the following message too. *** glibc detected *** dinamic: double free or corruption (out): 0x08894530 *** I declare the function EXTERN md5file(filename AS String, resultado AS Pointer) AS Pointer IN "mimd5sum" I call the function with DIM cas AS Pointer DIM cas2 AS Pointer DIM cad AS String cas = Alloc(33) cas2 = md5file("/prueba.txt", cas) cad = StrPtr(cas2) Message(cad) Free(cas) and the function in laguage C is: void miMDPrint (MD5_CTX *mdContext, char* resultado) { int i; char cadtemporal[3]=""; for (i = 0; i < 16; i++) { sprintf (cadtemporal, "%02x", mdContext->digest[i]); strcat(resultado, cadtemporal); } //strcat(resultado,""); } char* md5file (char* filename,char* resultado) { FILE *inFile = fopen (filename, "rb"); MD5_CTX mdContext; int bytes; unsigned char data[1024]; if (inFile == NULL) { //printf ("%s can't be opened.\n", filename); return NULL; } MD5Init (&mdContext); while ((bytes = fread (data, 1, 1024, inFile)) != 0) MD5Update (&mdContext, data, bytes); MD5Final (&mdContext); miMDPrint (&mdContext,resultado); fclose (inFile); return resultado; } Any idea about this problem is welcome. Regards. ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user