#Is it ok to use memcpy to combine two wchar_t strings?

1 messages · Page 1 of 1 (latest)

vestal stream
#

I want to read from stdin as wchar_t* string using fgetws and accumulate it in one buffer. I'am trying to use wcscat for this, but it's pretty slow. So I tried using memcpy and it seems to be working.

wet gateBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

vestal stream
#

Is it ok to use memcpy to combine two wchar_t strings?

amber notch
#

Personally I wouldn't do that

#

memcpy is efficient because, for one, it doesn't take precautions to avoid UB

#

Especially since you are taking stuff like user input

vestal stream
#

But i reading in a buffer with known size