0xc0000005: Access conflict occurs when reading a location; unprocessed exception: User breakpoint

Source: Internet
Author: User

These two errors are basically a problem. Access out of bounds.


In the program, I defined a cstring Class Object Str. Call sprintf (lpstr) (lpctstr) STR, "futures Forex, % 4D, % s, % 4D", m_sendata.m_datatime, m_sendata.m_pdataqh.code, m_sendata.m_pdataqh.buyin );

Change the STR value. The preceding dialog box is displayed.

Solution: STR is a char * In sprintf and is assigned to it with an excessively long string to generate access out of bounds.

The cause is that STR is not initialized. When an empty address is accessed or the access is out of bounds.


Note: No error occurs in the release version.

There are several reasons for this access error that does not belong to your memory space:

1. Allocate a small memory space to an array, and then assign a large value to the array.
Solution: allocate more memory space to the array, such as char Buf [1000];
2. The handle or pointer is released before use.
Solution: Check the code for debugging and pull out the wild pointer.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.