Wednesday, March 31, 2010

Re: [Cpp-Programming] What does this mean in debugging?

Without the code, we can't tell you what's wrong.  It looks like you are trying to dereference a pointer which is equal to 0 ("null pointer").

In Visual Studio, go to debug-->exceptions, and check all the boxes.  Then run your program in debug mode; when it crashes, it should tell you what part of code is throwing the exception.

  -BlueRaja


On Wed, Mar 31, 2010 at 2:54 PM, JoeC <enki034@yahoo.com> wrote:
First-chance exception at 0x5b5dba37 (msvcr100d.dll) in Color
Bitmap.exe: 0xC0000005: Access violation writing location 0x00000000.
First-chance exception at 0x5b5dba37 (msvcr100d.dll) in Color
Bitmap.exe: 0xC0000005: Access violation writing location 0x00000000.

I am using VC++ express.  I am trying to write a bitmap editor and I
have been having all kinds of strage memory problems.  I use a few
pointers mainly the one that holds the array for bitmap bit data.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.


--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

Re: [Cpp-Programming] Strange behavior.

You are deleting your bits array, creating a new array - which will contain garbage - then trying to flip the garbage.  This will give you flipped garbage.

Also, take a look at the signature for BitBlt; the upper-left hand corner of the image is (0,0), while the lower-right corner is (height-1, width-1).  Your call to BitBlt is telling it to start copying from the point (width, height).


On Wed, Mar 31, 2010 at 1:25 PM, JoeC <enki034@yahoo.com> wrote:
I am working on my own graphics program to where I can write my own
bitmaps.

Part of the problem is that the bitmap function draws butmaps upside
down.  So they have to be flipped.

These pieces of code are acting strange

void bitmap::display(HDC hdc, int ac, int dw){

       HDC dc = CreateCompatibleDC(NULL);

       VOID *pvBits;

       HBITMAP hbitmap = CreateDIBSection(dc,&bInfo,
                               DIB_RGB_COLORS,
                               &pvBits,NULL,0 );

       CopyMemory(pvBits, bits, (acc*dwn));

       SelectObject(dc, hbitmap);
       BitBlt(hdc, ac, dw, 16, 16 ,dc, 0, 0, SRCCOPY);
       DeleteDC(dc);

}

My problems are in the constructor:

To make it work I have to have this command and the copy functioned
commented out.
       delete [] bits;

       bits = new BYTE[acc*dwn];
       bits = flip();

BYTE* bitmap::flip(){

 BYTE * temp = new BYTE[acc*dwn];

 for (int index=0; index < dwn; index++)
  //memcpy(&temp[((dwn-1) - index)*acc],
   //       &bits[index*acc], acc);


 return temp;

}

If I don't use the flip command the program crashes.  The only way the
program will run is if I have the flip command and not use the flip
algorithm.  Why could the program be acting like this?  What else can
I do or look to get my program to




--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.


--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

Re: [Cpp-Programming] Why would this fail?

Well first off, you have a major memory leak:  whenever you have a call to new (or new[]), there should always be an associated call to delete (or delete[]).

Typically, what you do is pass in a buffer, and let the caller handle the delete (like memcpy does); however, in your case since it's just a temp array, you can simply do your computation in a local variable and copy the results back to your original array:

void bitmap::flipVertically()
{
    BYTE* temp = new BYTE[width*height]; //instead of "dwn*acc"
    for(int index=0; index < height; index++) {
        int reverseIndex = (height-1) - index;
        memcpy(&temp[reverseIndex*width],
            &bits[index*width], width);
    }
    memcpy(bits, temp, height*width);
    delete[] temp;
    //No need to return anything now!
}

There is also a way to do this without so large an array; do you see how?

As a general rule, you should never be returning pointers you allocated with new from a function.  This is something programmers coming from managed languages (C#, Java, etc.) often find quite surprising.

Hope this helps!
  -BlueRaja


On Wed, Mar 31, 2010 at 12:56 PM, JoeC <enki034@yahoo.com> wrote:
I have this piece of code that simply copies one array into another it
worked for a while now it fails what could make this fail?



bits = new BYTE[acc*dwn];
...

       bits = flip();

BYTE* bitmap::flip(){

 BYTE * temp = new BYTE[acc*dwn];

 for (int index=0; index < dwn; index++)
  // memcpy(&temp[((dwn-1) - index)*acc],
   //       &bits[index*acc], acc);


 return temp;

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.


--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

[Cpp-Programming] What does this mean in debugging?

First-chance exception at 0x5b5dba37 (msvcr100d.dll) in Color
Bitmap.exe: 0xC0000005: Access violation writing location 0x00000000.
First-chance exception at 0x5b5dba37 (msvcr100d.dll) in Color
Bitmap.exe: 0xC0000005: Access violation writing location 0x00000000.

I am using VC++ express. I am trying to write a bitmap editor and I
have been having all kinds of strage memory problems. I use a few
pointers mainly the one that holds the array for bitmap bit data.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

[Cpp-Programming] Strange behavior.

I am working on my own graphics program to where I can write my own
bitmaps.

Part of the problem is that the bitmap function draws butmaps upside
down. So they have to be flipped.

These pieces of code are acting strange

void bitmap::display(HDC hdc, int ac, int dw){

HDC dc = CreateCompatibleDC(NULL);

VOID *pvBits;

HBITMAP hbitmap = CreateDIBSection(dc,&bInfo,
DIB_RGB_COLORS,
&pvBits,NULL,0 );

CopyMemory(pvBits, bits, (acc*dwn));

SelectObject(dc, hbitmap);
BitBlt(hdc, ac, dw, 16, 16 ,dc, 0, 0, SRCCOPY);
DeleteDC(dc);

}

My problems are in the constructor:

To make it work I have to have this command and the copy functioned
commented out.
delete [] bits;

bits = new BYTE[acc*dwn];
bits = flip();

BYTE* bitmap::flip(){

BYTE * temp = new BYTE[acc*dwn];

for (int index=0; index < dwn; index++)
//memcpy(&temp[((dwn-1) - index)*acc],
// &bits[index*acc], acc);


return temp;

}

If I don't use the flip command the program crashes. The only way the
program will run is if I have the flip command and not use the flip
algorithm. Why could the program be acting like this? What else can
I do or look to get my program to


--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

[Cpp-Programming] Why would this fail?

I have this piece of code that simply copies one array into another it
worked for a while now it fails what could make this fail?

bits = new BYTE[acc*dwn];
...

bits = flip();

BYTE* bitmap::flip(){

BYTE * temp = new BYTE[acc*dwn];

for (int index=0; index < dwn; index++)
// memcpy(&temp[((dwn-1) - index)*acc],
// &bits[index*acc], acc);


return temp;

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

Tuesday, March 30, 2010

Re: [Cpp-Programming] Invitation to connect on LinkedIn

On Tue, Mar 30, 2010 at 1:03 PM, Kenneth Adam Miller <kennethadammiller@gmail.com> wrote:
wait-who is "Om" anyway? does he have some kind of notoriety?
 
No, damnit, this is spam.  I deleted it a month ago, now stop posting on this thread.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

Re: [Cpp-Programming] Invitation to connect on LinkedIn

wait-who is "Om" anyway? does he have some kind of notoriety?

On Tue, Mar 30, 2010 at 11:55 AM, Kenneth Adam Miller <kennethadammiller@gmail.com> wrote:
oh. ok, well that's cool. Like i said, I've never used linked in...


On Tue, Mar 30, 2010 at 11:28 AM, Sushil Parti <sushilcoolest@gmail.com> wrote:
Om is the name of person who has requested you to join his professional network


On Mon, Mar 29, 2010 at 7:04 AM, xh lin <linxianghui1987@gmail.com> wrote:
Hi I want to know what is Om? My English is not good enough , so I will be preciated that you tell me what is Om.
Thank you !

2010/2/22 Om Pirkash <pirkash@gmail.com>

LinkedIn

I'd like to add you to my professional network on LinkedIn.

- Om

Confirm that you know Om

© 2010, LinkedIn Corporation

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.


--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

Re: [Cpp-Programming] Invitation to connect on LinkedIn

oh. ok, well that's cool. Like i said, I've never used linked in...

On Tue, Mar 30, 2010 at 11:28 AM, Sushil Parti <sushilcoolest@gmail.com> wrote:
Om is the name of person who has requested you to join his professional network


On Mon, Mar 29, 2010 at 7:04 AM, xh lin <linxianghui1987@gmail.com> wrote:
Hi I want to know what is Om? My English is not good enough , so I will be preciated that you tell me what is Om.
Thank you !

2010/2/22 Om Pirkash <pirkash@gmail.com>

LinkedIn

I'd like to add you to my professional network on LinkedIn.

- Om

Confirm that you know Om

© 2010, LinkedIn Corporation

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

Re: [Cpp-Programming] Invitation to connect on LinkedIn

Om is the name of person who has requested you to join his professional network

On Mon, Mar 29, 2010 at 7:04 AM, xh lin <linxianghui1987@gmail.com> wrote:
Hi I want to know what is Om? My English is not good enough , so I will be preciated that you tell me what is Om.
Thank you !

2010/2/22 Om Pirkash <pirkash@gmail.com>

LinkedIn

I'd like to add you to my professional network on LinkedIn.

- Om

Confirm that you know Om

© 2010, LinkedIn Corporation

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

Monday, March 29, 2010

Re: [Cpp-Programming] Invitation to connect on LinkedIn

thx!

2010/3/29 Kenneth Adam Miller <kennethadammiller@gmail.com>
"Om" is not an english word. anyway, when you placed the second sentence in your email saying "My English is not good enough..." you didn't have correct grammar on the words after the comma. I know what you meant after the comma though. I think you should have worded that part like this:

so I will appreciate it if you tell me what Om is.

and no problem, any time.


On Sun, Mar 28, 2010 at 7:34 PM, xh lin <linxianghui1987@gmail.com> wrote:
Hi I want to know what is Om? My English is not good enough , so I will be preciated that you tell me what is Om.
Thank you !

2010/2/22 Om Pirkash <pirkash@gmail.com>

LinkedIn

I'd like to add you to my professional network on LinkedIn.

- Om

Confirm that you know Om

© 2010, LinkedIn Corporation

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, thxsend email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

Sunday, March 28, 2010

Re: [Cpp-Programming] Invitation to connect on LinkedIn

"Om" is not an english word. anyway, when you placed the second sentence in your email saying "My English is not good enough..." you didn't have correct grammar on the words after the comma. I know what you meant after the comma though. I think you should have worded that part like this:

so I will appreciate it if you tell me what Om is.

and no problem, any time.

On Sun, Mar 28, 2010 at 7:34 PM, xh lin <linxianghui1987@gmail.com> wrote:
Hi I want to know what is Om? My English is not good enough , so I will be preciated that you tell me what is Om.
Thank you !

2010/2/22 Om Pirkash <pirkash@gmail.com>

LinkedIn

I'd like to add you to my professional network on LinkedIn.

- Om

Confirm that you know Om

© 2010, LinkedIn Corporation

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

Re: [Cpp-Programming] Re: C++ documentation

I will give my experice and hope i can help you.
First when i learn cpp ,  i type the examples on the books , and run them.
Second i learn about a lot OO knowledge , i think it can help you to learn cpp better.
Third i insist on do ACM exercise on the web site.
I think if you will do after these three period , then you will know the cpp on a high level , and then you can study some books.
My English is not good , but i hope it can help you~

2010/2/17 kennethadammiller <kennethadammiller@gmail.com>
The best thing to do might just be to get with a partner that you can
ask questions. there's nothing like someone to just answer what you
want to know. I know how infuriating it can be when you want to know
something and you have to read 40 pages just to find that one thing.
Look to me. I have the same kind of initiative, and I've taught myself
two languages already, bash and C, and I'm working on learning the
rest of the object oriented side of C++ and the QT library.

On Jan 16, 7:46 am, Kapil K <kapil1...@gmail.com> wrote:
> Y.Kanetkar/ Balaguruswamy - The best for a beginner from my experience.
>
> Bjarne Strousrup may be the inventor of C++, but that book is not easy for a
> beginner.
>
> On Tue, Nov 24, 2009 at 10:03 PM, cosmin <cosmin.tana...@gmail.com> wrote:
> > Hello,
>
> > I'm  a noob in c++ programming, with a lot of willing to learn. First
> > of all, I managed to obtain more documentation than I can handle (all
> > kinds of tutorials and books). Amoung them, I have the Bjarne
> > Stroustrup's book, "The C++ Programming Language" (3rd edition). I
> > tried to assimilate it, but it works pretty hard on me, and sometimes
> > I have the impression that I cannot learn much from it. My question is
> > what to do in my case, if is there any other method to learn to code c+
> > + in a more efficient way than reading all that pages? Did you read
> > the book? If yes, how many times?
>
> > Thanks!
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "C++ Programming" group.
> > To post to this group, send email to cpp-programming@googlegroups.com.
> > To unsubscribe from this group, send email to
> > cpp-programming+unsubscribe@googlegroups.com<cpp-programming%2Bunsubscribe@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/cpp-programming?hl=en.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.


--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

Re: [Cpp-Programming] Invitation to connect on LinkedIn

Hi I want to know what is Om? My English is not good enough , so I will be preciated that you tell me what is Om.
Thank you !

2010/2/22 Om Pirkash <pirkash@gmail.com>

LinkedIn

I'd like to add you to my professional network on LinkedIn.

- Om

Confirm that you know Om

© 2010, LinkedIn Corporation

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.