Skip to content

Instantly share code, notes, and snippets.

@johnhmj
Last active April 3, 2017 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnhmj/caaab9b4b8814ff0e5fb6250cbeb2382 to your computer and use it in GitHub Desktop.
Save johnhmj/caaab9b4b8814ff0e5fb6250cbeb2382 to your computer and use it in GitHub Desktop.
Win32 C/C++ InitStruct macro, initialize your structure as ZeroMemory, http://johnmhsheep.pixnet.net/blog, https://johnmhsieh.blogspot.com/
#ifndef _INITSTRUCT_H_
#define _INITSTRUCT_H_
//
// initialize struct
#define InitStruct(s, t) memset((void*) s, 0x0, sizeof(t))
//
// copy struct
#define CopyStruct(s_dst, s_src, t) memcpy((void*) s_dst, (void*) s_src, sizeof(t))
//
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment