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.
Read More:
- Error c2137 of C language: empty character constant (Fixed)
- error C2137: empty character constant
- C / C + + error handling (document): unhandled exception: 0xc0000005: access violation while reading location 0x00000000
- Solving syntax error: unexpected character after line continuation character
- c# Newtonsoft.Json.JsonReaderException: ‘Error reading JArray from JsonReader. Path ‘‘, line 0
- Syntax error: unexpected character after line continuation character
- C – error: converting to execution character set:Illegal byte sequence
- Package inputenc Error: Unicode character , (U+FFØC) (inputenc) not set up for use with L aTeX. See
- C language string processing error warning, c4996, sprintf, predicted, c4996, strcpy, c4996, strcat
- error: unclosed character literal (How to Fix)
- error C2057: expected constant expression (Can the size of an array in C language be defined when the program is running?)
- Python’s json.loads Invalid control character
- MySQL modify character set
- Java prompt unmappable character for encoding solution
- Compiler error message: cs1056: unexpected character handling
- Differences between length() size() and C strlen() of C + + string member functions
- Java.lang.Character . isdigit() and isletter() methods
- There is an unhandled exception at: 0xc0000005: an access conflict occurred while reading location 0x00000000.
- Syntax error: invalid character in identifier
- ‘Conversion failed when converting date and/or time from character string.DB-Lib error message 241,