Working with file functions.

 

Good morning all,

I am trying to write and read a text file. I can read the contents of the text file, I am finding it tricky to write, delete, copy and move the contents of the file to a different location.

void Working_File()
{
string file = "Hello";
int o = FileOpen("Hello.txt",FILE_COMMON,CP_ACP);
Alert(o);// I think its working. Alert 1

string r = FileReadString(o);// working
Alert(r);

string  x = "Data OK";
uint w = FileWriteString(o,x,19);// Alert 0
Alert(w);

string rs = FileReadString(o);
Alert(rs);// Alert is empty

long s = FileIsExist(file,FILE_TXT);
Alert(s);// Alert 0
}
 
Stokes1976: I am trying to write and read a text file.
int o = FileOpen("Hello.txt",FILE_COMMON,CP_ACP);
  1. You don't specify if it is a text file, or binary.
  2. You don't specify if it is ANSI or Unicode
  3. You don't specify if you are reading, writing, or appending.