简体   繁体   中英

INTEGRITY violation - attempt to store into protected memory

I am using

GetClockAlarm(Clock TheClock, Boolean *Repeat, Time *AlarmTime, Time *AlarmInterval)

for fetching the clock time and interval into out parameters of API.

AlarmTime is pointer to structure which has (seconds and fraction as a structure member).

I am getting an error "attempt to store into protected memory".

I have tried using pointers referring structure but it is not useful.

void GetClockAlarm_(Clock TheClock){
    Time T3, AI;
    GetClockAlarm(Vclk2, true, &T3, &AI);
    printf("T3.Seconds = %llu\t\t T3.Fraction=%d\t\t \n",T3.Seconds,T3.Fraction);
}
 GetClockAlarm(Clock TheClock, Boolean *Repeat,Time *AlarmTime, Time *AlarmInterval) 

Look at the second argument which takes Boolean * but you are passing Boolean .

Maybe you want as below.

Time T3, AI;
Boolean boolVar = true;
GetClockAlarm(Vclk2, &boolVar, &T3, &AI);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM