Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
For NULL-embedded strings, CStringT::Find() produces what you may not expect
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026 for x86 #include <cstdio> #include <atlstr.h> #define DIMENSION(array) (sizeof(array) / sizeof(array[0])) int main() { unsigned char bytes[10] = { '\x53', '\x53', '\x53', '\x53', '\x00', '\x11', '\x53', '\x53', '\x53', '\x53' }; CStringA string(reinterpret_cast<char*>(bytes), DIMENSION(bytes)); for (int i = 0; i < string.GetLength(); ++i) { printf("0x%02x ", string[i]); } putchar('\n'); printf("%d\n", string.Find('\x11')); // -1 (!) }
run
|
edit
|
history
|
help
0
constmsvc
seh exception in constructor memory leak
Template
MSVC14 <exception> header
throwing std::function on MSVC is dangerous
MSVC14 <experimental/generator> header
delete from list
Generic EventProvider
iterator by value, by reference
infix to postfix v 3.0 with improved eval()