Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
For NULL-embedded strings, CStringT::Find() produces what you may not ...
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//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 (!) }
cl.exe
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 2.53 sec, absolute running time: 0.47 sec, absolute service time: 3,12 sec
edit mode
|
history
|
discussion
0x53 0x53 0x53 0x53 0x00 0x11 0x53 0x53 0x53 0x53 -1