Hi Mimmo,
If you need to create the file, then you need to swap $openfile() for $createfile()
$openfile() will open an existing file, but it won’t create a new file. if you pass kTrue as the second parameter, it will open the file read-only and you will not be able to write to it.
It’s probably a good idea to test the lError between each line of code as it executes, you can check to see if the command fails.
So, your code should look something like this:
Do FileOps.$Converthfspathtoposixpath(lName,lposxfile)
If lposxfile=”
OK message {Could not convert file path [lName]}
Else
Do lFileOps.$createfile(lposxfile) Returns lError
If not(lError)
OK message {Could not create [lposxfile]}
Else
Do lFileOps.$Writecharacter(kUniTypeAnsiLatin1,lritorno) Returns lError
If not(lError)
OK message {Could not write to the file [lName]}
End If
Do lFileOps.$closefile()
End If
End If
A man rushed into the doctor’s office and shouted, “Doctor! I think I’m shrinking!”
The doctor calmly responded, “Now, settle down. You’ll just have to be a little patient.”
Paul W. Mulroney
We Don't Do Simple Pty Ltd
ACN 161 009 374
Bentley Western Australia 6102