I want to copy a string into a new pointer 'word_name'. This variable is not modified, therefore the compiler displays an error that I should use const. However, I cannot pass a const pointer to @memcpy.
What is the solution for this problem, use @constCast or am i missing something?
Thanks for your help 🙂
const name_token = self.scanner.advance_word() orelse return ParsingError.General;
const word_name: []const u8 = try allocator.alloc(u8, name_token.len);
@memcpy(word_name, name_token);