CreateFile
_ and ReadFile
_ are not PureBasic functions, these are API, so ask Microsoft (or Linux, or Apple) support.
Use API directly requires often additional checks to be secure, so always prefere PureBasic internal functions when exist.
Your sample use CreateFile_ so API direct, not PurebBasic function.
Normal users do not have the right to write to the root of a system, all programmers know that from Windows Vista. Need admin rights.
No one programmer uses function 'Createfile()' or any I/O function on disk without prior verification (
if CreateFile())
PureBasic does not have Try/Catch mechanism, but have
OnError lib to trap errors. But in all cases, IF is the easiest and fastest way to avoid error.
Please do not crosspost same question on us and french forum, It is useless.