Memory location not allowed after 6.02

Just starting out? Need help? Post your questions and find answers here.
User avatar
matalog
Enthusiast
Enthusiast
Posts: 305
Joined: Tue Sep 05, 2017 10:07 am

Memory location not allowed after 6.02

Post by matalog »

I have this code, which works in 6.02, but doesn't work after

Code: Select all

Global.i *buf
 ReadFile (0, "C:\txt.txt")
*buf = AllocateMemory (Lof (0))
ReadData (0, *buf, Lof(0))
CloseFile (0)
After 6.02 it reports an error that Native types can't be used with pointers.

What should I change to get this working in later versions?
User avatar
jacdelad
Addict
Addict
Posts: 2032
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Memory location not allowed after 6.02

Post by jacdelad »

Code: Select all

Global *buf
 ReadFile (0, "C:\txt.txt")
*buf = AllocateMemory (Lof (0))
ReadData (0, *buf, Lof(0))
CloseFile (0)
Simply remove the ".i" since pointers already automatically have the correct variable type.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
User avatar
matalog
Enthusiast
Enthusiast
Posts: 305
Joined: Tue Sep 05, 2017 10:07 am

Re: Memory location not allowed after 6.02

Post by matalog »

jacdelad wrote: Mon May 06, 2024 11:08 pm
Simply remove the ".i" since pointers already automatically have the correct variable type.
Thanks.
Post Reply