c++ - Segmentation Fault upon call to GetSystemTime() function (Windows) -


i'm having trouble dealing segmentation fault. following sanity check throws one:

#include <windows.h> int main() {     lpsystemtime starttime;     getsystemtime(starttime); } 

however, i've used same code in larger program, , runs without problem. i've tried adding delays in various places in case problem stems sort of multithreading within getsystemtime(), did not solve problem.

i'm compiling mingw-gcc in codeblocks.

lpsystemtime pointer systemtime structure. don't initialize pointer it's pointing somewhere scenery, hence access violation/seg fault.

in order make code work, have make sure pointer points valid systemtime structure. per msdn docs, microsoft explicitly warns passing in null pointer result in access violation.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -