Skip to content

Instantly share code, notes, and snippets.

@TomMD
Created August 14, 2017 15:57
Show Gist options
  • Save TomMD/a6be83777722e7af7125d9f3bf2918ee to your computer and use it in GitHub Desktop.
Save TomMD/a6be83777722e7af7125d9f3bf2918ee to your computer and use it in GitHub Desktop.
Using memset_s
tommd@HalfAndHalf /tmp% cat dw.c
#define __STDC_WANT_LIB_EXT1__ 1
#include <string.h>
int main()
{
unsigned char data[10];
memset_s(data,10,0,10);
return 0;
}
tommd@HalfAndHalf /tmp% gcc dw.c -o dw && ./dw
tommd@HalfAndHalf /tmp% echo $?
0
tommd@HalfAndHalf /tmp% gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment