Hi,
I have problem with copy the bitmap* to char* using memcpy.
Here I given my code,
char* cbuffer;
int size = 240000;
Bitmap *bitmap = new Bitmap(L"Image.bmp");
bitmap->Rotate(RotateNoneFlipX);
memcpy(cbuffer,bitmap,size);
FILE *fptr;
fptr = fopen("image2.bmp","wb");
fwrite(cbuffer,1,size,fptr);
fclose(fptr);
In My above code, the image2.bmp has not saving.
What is the problem?
3 1458
Hi,
I have problem with copy the bitmap* to char* using memcpy.
Here I given my code,
char* cbuffer;
int size = 240000;
Bitmap *bitmap = new Bitmap(L"Image.bmp");
bitmap->Rotate(RotateNoneFlipX);
memcpy(cbuffer,bitmap,size);
FILE *fptr;
fptr = fopen("image2.bmp","wb");
fwrite(cbuffer,1,size,fptr);
fclose(fptr);
In My above code, the image2.bmp has not saving.
What is the problem?
Hi,
Is this code running fine?
Whay i am asking this is, you havent allocated any memory for the cbuffer.
Raghuram
Hi,
Is this code running fine?
Whay i am asking this is, you havent allocated any memory for the cbuffer.
Raghuram
Thanks for your reply.
Above code is not working proberly. Actually this code was created through DLL. I checked with my exe but the image was not creating.
How I allocated the memory to char buffer.
Is there any option in c++ or vc++?
Thanks for your reply.
Above code is not working proberly. Actually this code was created through DLL. I checked with my exe but the image was not creating.
How I allocated the memory to char buffer.
Is there any option in c++ or vc++?
Are you aware of malloc/calloc/new in C++ or in C.
You have to start reading that before using it
Raghuram
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ronny |
last post by:
Can anyone tell me why the following code works fine using an array.
<snip>
double xVal; // array
mxArray *X = NULL; //MatLab mxArrays
|
by: manya |
last post by:
Ok, it's been a while since I've done the whole memcpy stuff with C++
and I'm having a hard time remembering everything.
I hope, however, that you can help me with my problem.
I memcpy a...
|
by: Case |
last post by:
#define SIZE 100
#define USE_MEMCPY
int main(void)
{
char a;
char b;
int n;
/* code 'filling' a */
|
by: myhotline |
last post by:
hi all
im very confused about using memcpy and i have three
questions....memcpy takes a pointer to src and a pointer to dest and
copies src to destination...but im very confuzed about when to...
|
by: Peter Pichler |
last post by:
A colleague encountered an interesting problem. Suppose we have a C
function like this:
void WRITE_THING(void* addr, THING t)
{
memcpy(addr, &t, sizeof t);
}
to copy a THING to any byte...
|
by: ebrahimbandookwala |
last post by:
HI everyone
I am supposed to pass back a pointer to a struct from a function whos
definition cannot be changed
flight_t * get_item(field_t field , void * data)
the problem I encounter is...
|
by: Martin Jørgensen |
last post by:
Hi,
I'm relatively new with C-programming and even though I've read about
pointers and arrays many times, it's a topic that is a little confusing
to me - at least at this moment:
----
1)...
|
by: naren |
last post by:
Iam not getting the correct pros and cons of the strcpy() and memcpy()
some where i read for short strings strcpy is faster and for large
strings memcpy is faster..
in strcpy() there is a single...
|
by: danu |
last post by:
Basically I'm trying to do here is put the uint32_t seq_num into the
first 4 bytes of the buf. But every time I do this, it wouldn't get
copied in to the buf at all. Can anyone point out the...
|
by: Mark |
last post by:
Hi List,
I want to write a function to copy some data out of a hardware buffer.
The hardware can change the contents of this buffer without it being
written to by my function. I want to use...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |