this is a very subtle error
this error means that the memory that the variable reads holds a data type that is actually a sequence of characters, not the data type specified by the variable type.
the general reason for this error is:
char* buffer = (char*)malloc(sizeof(char) * 1024); char *p = NULL;
what happens when the buffer contains more than 1024 bytes of data?
yes, the value of p is overwritten by buffer. When checking p during debugging, it will be found that p is no longer NULL, and the error will be “error reading character of string”.
C++, we still try to use STL containers, because STL containers will automatically expand. If above code is:
std::string buffer; char *p = NULL;
I believe this error will not occur again.
- error C2057: expected constant expression (Can the size of an array in C language be defined when the program is running?)
- C++ cin.ignore Use of ()
- error: unclosed character literal (How to Fix)
- How to Fix char cannot be dereferenced Error
- The problem of strncpy and the solution of GCC compile time checking
- Error c2137 of C language: empty character constant (Fixed)
- There is an unhandled exception at: 0xc0000005: an access conflict occurred while reading location 0x00000000.
- 0xc0000005: solution to access conflict when writing to location 0x00000000
- How to Solve mybatis returns null when querying Oracle database with char type field
- Mybatis integrates Oracle query and reports an error in the datetime type field
- Usage of NVL in SQL
- Difference between isempty method and isblank method in stringutils
- error C2137: empty character constant
- Tensorflow: How to use expand_Dim() to add dimensions
- [Warning] incompatible implicit declaration of built-in function ‘strcat’
- Parsing the exception of storing JSON string in cookie
- Solution of adding judgment error in the iterative process of Java iterator iterator
- Python’s json.loads Invalid control character
- Differences between length() size() and C strlen() of C + + string member functions
- CIN in C + + cin.get ()、 cin.getline (), getline(), gets() function