3 ms·
The Microsoft approach to this was to make a set of replacement functions (strsafe.h [1]) that are very explicit and not at all “clever”, as the strsplcasdfcpy
by wrs 7y ago
The Microsoft approach to this was to make a set of replacement functions (strsafe.h [1]) that are very explicit and not at all “clever”, as the strsplcasdfcpy functions seem to want to be. They return an error code so it’s obvious when the operation did what was expected, or ran out of space.
[1] https://docs.microsoft.com/en-us/windows/win32/menurc/strsafe-ovw https://docs.microsoft.com/en-us/windows/win32/menurc/strsaf...
- dwheeler 7y agoBut most people want to use standard, portable calls. The C standard tried to add such functions in "Annex K", but unfortunately annex K hasn't received much of a pickup (for various reasons). So in many places the problem continues.