2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Accessing T6 struct leads to a crash?
#485132
01/26/22 17:35
01/26/22 17:35
|
Joined: Jul 2017
Posts: 785
Zheka
OP
User
|
OP
User
Joined: Jul 2017
Posts: 785
|
This leads to a crash: int main() {
T6* t;
t->fHigh =1;
return 1;
} Why would this be?
Last edited by Zheka; 01/26/22 17:36.
|
|
|
Re: Accessing T6 struct leads to a crash?
[Re: Zheka]
#485138
01/26/22 21:10
01/26/22 21:10
|
Joined: Feb 2017
Posts: 1,731 Chicago
AndrewAMD
Serious User
|
Serious User
Joined: Feb 2017
Posts: 1,731
Chicago
|
No need to call malloc or low-level file functions, just use datasets. T6 is a seven-field dataset (where element 0 is the timestamp and also the beginning of the struct). dataStr can be used to return a pointer to your T6 struct. For storing complex data such as structs, use a sufficient record size plus 8 bytes for the timestamp, and copy the struct to dataStr(Handle,Record,1). If a separate timestamp is not needed, or if it is part of the struct as for the T1..T8 structs, the struct can be stored to dataStr(Handle,Record,0). https://www.zorro-project.com/manual/en/data.htm
|
|
|
Re: Accessing T6 struct leads to a crash?
[Re: Zheka]
#485142
01/27/22 12:22
01/27/22 12:22
|
Joined: Feb 2017
Posts: 1,731 Chicago
AndrewAMD
Serious User
|
Serious User
Joined: Feb 2017
Posts: 1,731
Chicago
|
No. I don't get this error on 2.45.8.
EDIT: Oh, but I get it on 2.46.2. That's a bug with the stdio.h header.
Last edited by AndrewAMD; 01/27/22 13:07.
|
|
|
Re: Accessing T6 struct leads to a crash?
[Re: jcl]
#485145
01/27/22 14:03
01/27/22 14:03
|
Joined: Jul 2017
Posts: 785
Zheka
OP
User
|
OP
User
Joined: Jul 2017
Posts: 785
|
The stdio.h file has some lines inside that don't belong in that file. If you want, you can remove all lines with a "clib" and also the corresponding function prototypes. That will fix the error. Ok, i will. So those will be removed in the next update?
|
|
|
|