News for hackers. Stuff that matters.
Re:C Strings and my slow descent to madness by bluGill on Thursday April 06, 2023 @05:33PM (#35474813)
Unfortunately there often isn't a better replacement in your standard library (embedded systems are weird). I ended up using strncpy followed by automatically setting the last byte of the string to null.
Re:C Strings and my slow descent to madness by PaulDavisThe1st on Thursday April 06, 2023 @06:33PM (#35475436)
strncpy() in particular is so bad that you're better off (for a rare exception to the rule) just writing your own, that does what most people think strncpy() does (or should do) rather than what it actually does.
Re:C Strings and my slow descent to madness by saagarjha on Thursday April 06, 2023 @09:36PM (#35476989)
Wrap memccpy.