Help with windows 64bit crash

Hey guys.

I am trying to compile a simple program on 64 bit Windows 7 and I have a crash problem.

My app is crashing when ever I call a function, and according to QT Creators debug tool it is being caused by a segmentation fault.

I do not understand what is wrong though. Any ideas?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <windows.h>

int getHour(){
    LPSYSTEMTIME systemTime = NULL;
    GetSystemTime(systemTime);
    return (int)systemTime->wHour;
}

//The crash occurs when the following is called:
int main(){

int n = getHour();

}
GetSystemTime doesn't create a new SYSTEMTIME struct, it only outputs on an existing one. So instead,
1
2
3
4
5
int getHour(){
    SYSTEMTIME systemTime;
    GetSystemTime(&systemTime);
    return (int)systemTime.wHour;
}


This should work, though I didn't try it.
Thanks :) This worked nicely! Appreciate it!
Topic archived. No new replies allowed.