So, I've got this buffer that I want to print out byte by byte. When the buffer contains a string, everthing works just fine, but then I want to encode the buffer, and print it out again. I don't care if a byte doesn't correspond to a good looking ascii character, I just want to see what I've got. For some reason though, I can't seem to print out the whole thing.
Here is what i've got...
char *buffer = malloc ( 520 );
unsigned short *bufferLen = malloc ( sizeof (short) );
strcpy ( buffer, "This is buffer");
*bufferLen = (unsigned short) strlen ( buffer );
printf ( "%s", "Buffer -->" );
for ( i = 0; i < *bufferLen; i++ )
putc( buffer[i], stdout );
printf ( "%s", "<--\n\n" );
And it works fine... but as soon as I've got some wierd bytes in my buffer, it will stop printing to screen... I even lose the ending "<--"!!!! When I decode and print... everything is good again, so I know that I am not loosing my information... I just can't print it!!