NicoPrenzel
Technical User
Hello All,
this is my first post to this forum. Too, my C knowledge isn't really good! So my question could be hopefully easy to answer!
I call this function
PrintItemString(pPart, MimePartStruct.wByteCount, &mess );
where:
MIME_PART MimePartStruct;
char *pPart;
unsigned char *mess;
AND
int max_size = 250 * 1024;
if ((mess = malloc( max_size + 1 )) == NULL)
{
AddInLogMessageText( "Out of memory", NOERROR );
}
MIME_PART gives me a struct with description of length of binary part in pPart!
pPart does have binary characters (file) stored!
My aim is to store the binary characters (file) into mess.
The line
fprintf (dumpfile, "%c", *c);
gives me the right binary output into dumpfile!
But if i print out mess it gives me some wrong output!
Could someone please help?
Best regards!
NicoP.
void LNPUBLIC PrintItemString(char *pText, WORD iText, unsigned char **mess )
{
long int nChars = 0; /* How many characters have been written out? */
if (iText != 0)
{
while (iText--)
{
unsigned char *c = pText++;
fprintf (dumpfile, "%c", *c);
*mess = strcat( *mess, c );
nChars++;
}
}
return;
}
this is my first post to this forum. Too, my C knowledge isn't really good! So my question could be hopefully easy to answer!
I call this function
PrintItemString(pPart, MimePartStruct.wByteCount, &mess );
where:
MIME_PART MimePartStruct;
char *pPart;
unsigned char *mess;
AND
int max_size = 250 * 1024;
if ((mess = malloc( max_size + 1 )) == NULL)
{
AddInLogMessageText( "Out of memory", NOERROR );
}
MIME_PART gives me a struct with description of length of binary part in pPart!
pPart does have binary characters (file) stored!
My aim is to store the binary characters (file) into mess.
The line
fprintf (dumpfile, "%c", *c);
gives me the right binary output into dumpfile!
But if i print out mess it gives me some wrong output!
Could someone please help?
Best regards!
NicoP.
void LNPUBLIC PrintItemString(char *pText, WORD iText, unsigned char **mess )
{
long int nChars = 0; /* How many characters have been written out? */
if (iText != 0)
{
while (iText--)
{
unsigned char *c = pText++;
fprintf (dumpfile, "%c", *c);
*mess = strcat( *mess, c );
nChars++;
}
}
return;
}