Why save it to a file, if you want to save it to a database? You get it as a bitmap in the first place, just use GetBitmapBits
] and save them as an Image field in your DB...
Which part of this is causing a problem?
"fread function is not reading properly, so while executing the query it leads to exception. StrByte is empty."
Um. This one?
FILE * fp= NULL;
fp = fopen(szSingle,"wb");
if(fp == NULL) return ;
Have a look at this: fopen specification
Pay attention to where it says:
w or wb
Truncate to zero length or create file for writing.
"Still my buf contains only 4 characters. How to read the jpeg file fully in order to save it in the database. help me"
Now, (assuming you changed the "wb" to "r" or similar) you need to look at two things:
] with reference to the second and third parameters:
If you want to continue working with the actual data...
Why 150? Is this a Magic Number for you? It bears no relation to the bitmap size, at all...
How do you know it only has 4 characters? What should it have?
Are the first two by any chance #42 and #4D?