File unable to delete

 

I created a file. I want the file to be created when necessary and deleted when necessary, without writing anything to the file. The idea is to use the file as a key to perform an action. If the file exists action A should be take. On the other hand, if the file does not exist action B should be take. Unlike variables, which are always initialized when the Terminal is closed or when your computer is restarted, the file method has no this limitation. It still retains the value of exist or deleted while the computer is restarted or Terminal closed. Now there are times when the file should be created and when the file should be deleted. But the file has not been able to be deleted. See the code I used in trying to delete the fileas follows:

if (FileIsExist("KeyFile.txt")==true)type = "valid";
if (FileIsExist("KeyFile.txt")==false)type="invalid";
if (type=="valid")FileDelete("KeyFile");
if (type=="invalid")FileOpen(KeyHandle,FILE_WRITE|FILE_TXT);FileClose(KeyHandle);
//Something like that...
 
To answer your question @WHRoeder, the return value for the OrderDelete() function is a bool one and the value is false since the file did not succeed in deleting. I printed the value of the OrderDelete() function and it is 0. The same question still goes in a different way: Why is the OrderDelete() function returning false?
 
macpee:
To answer your question @WHRoeder, the return value for the OrderDelete() function is a bool one and the value is false since the file did not succeed in deleting. I printed the value of the OrderDelete() function and it is 0. The same question still goes in a different way: Why is the OrderDelete() function returning false?

There is no OrderDelete() in your code that you show

If you don't want to actually write anything to the file, why don't you use a Global Variable of the Client terminal?

If you want to delete a file , use FileDelete()

 
macpee: To answer your question @WHRoeder, the return value for the OrderDelete() function is a bool one and the value is false since the file did not succeed in deleting. I printed the value of the OrderDelete() function and it is 0. The same question still goes in a different way: Why is the OrderDelete() function returning false?
  1. Had you bothered to read the links I provided, you would know I hadn't said to print the bool.
  2. Had you done what I requested you would know "Why is the OrderDelete() function returning false."
 
WHRoeder:
macpee: To answer your question @WHRoeder, the return value for the OrderDelete() function is a bool one and the value is false since the file did not succeed in deleting. I printed the value of the OrderDelete() function and it is 0. The same question still goes in a different way: Why is the OrderDelete() function returning false?
  1. Had you bothered to read the links I provided, you would know I hadn't said to print the bool.
  2. Had you done what I requested you would know "Why is the OrderDelete() function returning false."

Sorry everybody. It is FileDelete() I mean to say and not OrderDelete(). I must have written the comment in a hurry. But @WHRoeder, I actually followed your link, but It did not help me in any way. Thanks anyway. Now @GumRai, does a global variable of the terminal retain its last value at restart of the computer? If so, then it is better to use. I shall give it a try now. Thank you for the information.
Reason: