Extended API to accept C-style strings with length specified.