On 11/1/21 1:49 PM, pascal111 wrote: > Yes, I'm practicing doing things in low level style like standard C.
All you needed extra was to let the slice know about the new length: import std.stdio; import core.stdc.string; void main() { char[] s="xyz".dup; strcpy(&s[0], "Hello World!"); s = s.ptr[0..12]; // <-- Here writeln(s); } Now, the result is "correct" without dup: Hello World! The program is as incorrect as its C equivalent would be. ;) Ali