GetFileCont stores data from a file in mem and the number of bytes in bnum. Since the first example works, I dont think that function is the source of the problem. What am I doing wrong here?
version 2 accepts a parameter constchar* s
and the description states that s is a pointer to a null-terminated sequence of characters.
In other words, the operation will copy characters from the address pointed to by s until a null byte is found. Thus it is not suitable for copying binary data, it is only suited to ordinary character strings.
I'm not sure whether there is a good or simple way to do that. You could allocate a string of the required length, and then copy using some method or other from your mem buffer.
But I'm wondering why you want to do this. Is it just an experiment or does it serve some purpose?